Masking Vertex Animation

unity
shaders

#1

I have a shader that applies vertex animation to the object. I am wondering how I would create a dynamic mask that could apply the animation to only part of the object (i.e. the back or tail of the object). I have been trying to figure this out in Unity’s new shader graph, but I would assume the principles of achieving this effect would be the same across other engines. Does anyone know how I could do this? Thanks!


#2

Obviously it’s going to depend a bit on what your animation looks like. However since most vertex animation involves an offset from the vertex position that is fed into your fragment shader, the most common masking method is simply have a per-vertex masking value (which you could stuff into a UV channel or a vertex color. You’d just multiply the offset you’ve calculated against the masking value before adding it to the incoming vert position – if your multiplier value is zero the vert won’t be deformed. You can scale the effect with values between zero and one (or, for that matter, larger than one).