NokiMo
pucklovesgames
pucklovesgames

patreon


Foliage Wind Movement - FILES

Here's a very simple foliage shader than moves in the wind, and a script that sets the required global shader values. To change the direction the wind is blowing, simple rotate the object that the WindControl script is on.

It works by panning a world space noise texture across the mesh and offsetting the vertices.

To control the strength of the effect over the foliage, you'll need to paint vertex colours into the mesh - with the alpha (A) value controlling how much each vertex is influenced by the wind. You can edit this in your modelling program, or using a free asset such as Polybrush https://unity3d.com/unity/features/worldbuilding/polybrush
There's also this cool Vertex Gradient Editor made by Daniel Snd that looks like a perfect tool for the job!  https://snddev.tumblr.com/post/173483488414/gradient-generator-and-vertex-gradient-editor 

IMPORTANT: The foliage movement uses the noise texture to offset the vertices, and it's very sensitive to texture compression, which will create a jittery movement. To fix this, make sure in the Noise_ed_blurred.jpg Texture settings, you set the Compression to "None", and if you're still getting jitter, try setting the Max Size to 128. A smaller max size will interpolate between the pixels and create a smoother movement.


I've also included the Fading opacity effect when the foliage gets too near the camera, to stop it from occluding the players view. You can just unhook that from the Opacity if you don't need it.

This is a very basic wind foliage setup - there's heaps more you could do to improve the shader (such as offsetting the timing of some of the leaves in the foliage by Vertex Color R perhaps, and stacking the noise into multiple layers of varying scale for better movement variation), but hopefully it gives you a good starting point on how to achieve this effect.

Foliage Wind Movement - FILES Foliage Wind Movement - FILES

Related Creators