2 juin 2016

Rain using vertex animation

My goal was to create a rain effect around lights without using particles to save CPU time

So i started this idea using a simple mesh with a vertex animated shader to avoid unnecessary overdraw



I am using a simple mesh with a few planes, i order to rotate the planes to look at the camera at all time i am using the Spline thicken function in unreal to get all the planes to be align with the camera.
I could have made cross mesh and made the shader a bit cheaper but the Spline thicken function allow me to change the length of the rain in the material. 


Then i used a the vertex animation to get the motion in local space. the solution was OK but i was lacking variation in the motion. so i decided to use vertex color to control the speed and time offset.


After that i decided the add more timing variation using the mesh pivot point


I am using the blue channel to add more speed and i am using the red channel to add some timing offset. 

After that i wanted more variation so i added a rotation on the mesh, unfortunately it did not play well with the spline thicken function. I ended up with some moment with the rotation when the all the plane were badly align with the camera.
I could have added some rotation to the base mesh to avoid that but it wouldn't have work with the spline thicken well.


Here is a video with the result. I've added control over the speed, range of travel, length of the water, tint, etc..