Why does fragment shader quality decrease on vertex displacement?

Hi all,
why does the quality of the fragment output decrease, once i add some displacement in the vertex shader?

to demonstrate my problem i made the following simple shader in the nme:

https://playground.babylonjs.com/#9BKDIN#5

info:

  • a simple cellular noise map serves as fragment output
  • the same noise is used to change the vertex position along its normal for an animated displacement

problem:

if I set the displacement to any value, the resulting fragment shader looks like being overwritten by vertex color or something (very low res) (marked as 1)

image

if I completely ignore the vertex shader, my cellular noise is pretty and high res (marked as 2)
image

why does this happen?
how can i keep the high resolution on a displaced mesh?

thanks
Danny

hi. I dont know why but for displacement you need increace polygons count of your mesh https://playground.babylonjs.com/#9BKDIN#7

Yup, definitely a precision issue. so increasing sub div adds more points and increase the rendered “precision”.

thank you two,
I found another solution which decouples geometry detail from color detail

https://playground.babylonjs.com/#9BKDIN#9

i duplicated the whorley noise node and used this second one as the fragment input. you can see that i now have my low poly icosphere (16 subdivs instead of 256 subdivs) with full resolution colors.

But i dont understand why I need that second whorley noise node, (which should generate the exact same values as the first one.)

1 Like

This is BEAUTIFUL!

1 Like