Fiddling around with the refraction settings of the Lit shader, I’ve achieved a decent rain effect without using particles for the drops in air. Here it is in action:
The effect of the falling raindrops is achieved with a cylinder mesh (or 3 cylinders of different sizes to be exact) around the camera. The mesh has a material with a tiling texture with a bunch of raindrops, some refraction and a normal map. The ”Offset” setting of the textures in the material gets updated by a looping animation. The cylinder follows the camera’s position (not rotation), and for this I used a Position Constraint from the Animation Rigging package.
As a general technique, using rain planes and rain cylinders is nothing new of course. It’s mentioned for example in this thread at gamedev.net about alternative solutions for rain, but they delve even more into the nitty-gritty.
This technique has some drawbacks compared to a regular particle effect:
- If you’re looking upwards or downwards, you can see the lower edges of the cylinders (or at least the lack of raindrops very close to the camera).
- The angle of the raindrops may look somewhat off at the sides of the screen.
- The waterdrops most on the right and left also bleed a bit of white from the edges of the screen, but this problem can be reduced to almost nothing by using ”Thin” refraction model and a ”Screen Space Refraction” override in the Volume, as I explain later.
But the good sides are:
- A convincing rain effect would require tons of raindrop particles, so this technique probably causes less performance overhead
- It’s easier to add an appearance of motion blur to the drops when they are part of a bigger texture
- No need to make a custom shader for HDRP that works with particle fade and has refraction (though this might be easy, I don’t have much experience with shaders so it’s a positive for me at least)
For the floor ripples, I used just a regular particle effect with a plane shaped like the floor as the emitter. However, if you want to go the whole hog and have the rain effect completely without any particles, I think the Shadergraph tutorial by PolyToots linked below looks very interesting. He makes it as a PBR shader though, I haven’t tried following the tutorial with HDRP:
Unity Shadergraph: Rain Drop Ripples! (Tutorial by PolyToots)
The process of making the rain cylinder and textures
I started off by making the textures for the rain. Whatever tool of your choice you make it in, you should end up with a tileable texture of white waterdrops on transparent background something like this:
From the black and white, you can make a normal map in Photoshop by choosing Filter > 3D > Generate Normal Map. Be sure to tick ”Invert height”, but apart from that, I went with the default settings.
Next I made the cylinders in Blender, by just making a cylinder, removing the caps, and flipping the normals. Below you can see the mapping of the 3 cylinders of different scales around the camera. The innermost has the smallest UV island (since the scale of the cylinder is smallest as well). I scaled the UVs keeping in mind that the textures in the material will tile 4 times in width and length. So the innermost has a scale of 0.75 times the medium one.
Having the 3d model and textures in Unity (with the normal map marked as a normal map), I then made the material. In the picture below, I’ve circled the settings to change.
Next you’d have to make the animation. Material settings are easiest to animate with the recording tool. When your empty animation is ready and attached to the cylinder, with the cylinder selected, change the ”Offset” settings to something else, then back to zero for the first frame. Then go forward to 3 seconds, and set the offsets to X=1 and Y=3 (or whatever works with your texture).
To make the rain cylinder follow the camera, I used a Position Constraint from the Animation Rigging package.
There’s just one step left for the rain cylinder itself. You’ll notice the rain bleeds a lot of white from the edges of the screen. The higher the material’s Index of Refraction setting is, the more prominent this problem is. Also, with the ”Box” refraction model it seems to be least noticeable.
Luckily there’s something you can do to reduce this bleeding to almost nothing. In your Volume component, add a ”Screen Space Refraction” override, and reduce the ”Screen Weight Distance” to minimum.
Floor ripples
For the floor ripples, I went with just a simple particle effect myself. However, as mentioned in the beginning of this post, be sure to check out this tutorial by PolyToots.
Here’s just of simple process video of making the ripples as a regular particle effect:
Below is a version of the falling raindrops done with VisualFX graph, just for comparison of the looks. There’s no visible difference in performance on my system (since neither effect seems to affect my performance at all), but with 400 000 particles visible at a time in an area of 10 x 10 units around the player, I can imagine this being more costly to the GPU. Also, the raindrops are falling so fast that they appear to be flashing in and out of view rather than falling. Perhaps that could be improved by baking motion blur into the texture and controlling the rotation of the particles accordingly though.