I wanted to show you an old project of mine where I created a rain post process shader.
First there should be at least four features which have to show up: the rain drops themselves, water which is flowing on the surfaces, there should be excluded areas from this effect and refraction which shows up if you take a closer look at the rain flooded surfaces.
The rain drops are pretty straight forward: one drop texture which is tiled several times and layered above each other is linear interpolated based on the scene depth. This just gets added to the final scene color.
The next step is to build up the setup for the water flowing over the surfaces. First we need the World Normal to get information in which direction the water should flow. I have masked out the blue channel since it indicates that the normals point upwards. The rest (one minus this value) is water that flows downwards. Of course the normals have to be normalized at the start to avoid artifacts.
This information will be the base to create appropriate UV motions. I use it as a time mask which can be set up with brightness and contrast. In the end both UV coordinate sets (the down flowing water and the water on the ground) are interpolated based on the normal direction.
To avoid obvious tiling patterns on bigger surfaces I add some of the color information to the resulting UVs and use it as an offset.
I use the red channel of the flowing water (without color) as a base for computing the screen refraction. This is interpolated by the depth fade to see it only when nearby. It is now used as UV-set for the final scene color.
To exclude parts of the which should not be affected I used the custom depth buffer. I compare the scene depth with the custom depth and it results into a grey scale mask which I use for masking out the rain before adding it to the scene.
The following scene is test scene bought from the Unreal Marketplace and is not done by me. I use it just for tests of my shaders and effects.The pictures below show the scene without and with the above described effect. I darkened the scene a little bit to have a more realistic rainy weather look and better contrast.
The outcome is not perfect on every spot but overall it is a fast way to change your scene’s weather.