Node Material Vertex Animation Issue

Hello, and I have an unusual issue which is demonstrated in the following playgrounds:

I have a shader which takes UV coordinates and converts them into polar, for use in an animated ramp. The shader blends a noise function against the animated ramp, and moves along the transformed coordinates. Some of the nodes connections are failing, or need to be rebuilt after modifying the vertex position.

Here is a playground with the effect working as expected:
https://playground.babylonjs.com/#FEEK7G#230

In the second version of the shader (with animated vertex positions #120), I am using the same animated ramp to drive vertex positions. The vertex displace as expected, but the noise function no longer behaves as expected; using the non-polar coordinates instead.

In the third version of the shader (debug destroyed y direction #128), I have attached the output of the transformed UV coordinates to an input for debugging.

In the fourth version of the shader (debug rebuilt y direction #129), I have rebuilt the UV transform function using unique nodes and connected it as an output for debugging. This shows the correct information, despite being made of the same nodes.

Do I need to be updating UV or N after changing the vertex position? It looks like the noise continues to animate in Y, but the coordinate is not polar after modifying the vertex.

Robert

this definitely sounds like a @Evgeni_Popov mission :slight_smile:

It looks like the problem is coming from sharing nodes between vertex and fragment functions. I have been further breaking down the graph, and it is working where nodes are not being shared.

r

It can be that some nodes are evaluated in the vertex shader instead of the fragment. You can force some nodes to be evaluated in the fragment (or vertex) shader by setting the target:
image

1 Like