Wind Shake Shader

Wind Shake shader

This shader is similar to the Vertex Displacement shader, where we modify the vertex position in the ‘Vertex shader’ to make it appear moving on the screen. However, in this case, we not only move the vertex in a particular axis but also make the amplitude of movement lower at the bottom and linearly increase towards the top.

In order to attenuate the displacement vertically, just multiply the Y-axis of the vertex position with the ‘Sine Time’. Use the ‘Split’ node to get the Y-axis.

Note that I am translating the Y-axis range from -1, 1 to 0, 1 by multiplying and adding with 0.5. Also, I am controlling the speed and amplitude of sinusoidal oscillation by multiplying ‘Time’ with the Speed property and multiplying ‘Sine’ with the Amplitude property.

Now add the resulting output with the X-axis of vertex position and finally combine X, Y, and Z axes using the ‘combine’ node and assign it to the ‘Position’ input of the Vertex shader.

Thats it! We got our object shaking like a tree due to heavy wind.