Rain, raindrops, puddles, and water in Unity HDRP

One effect I used in my first episode is rain to amplify the mood. This involved raindrops on glass windows, rain falling from the sky, and ripples/puddles of rain on the ground.

Here is an example shot with rain falling from the sky, glistening in the lights, with puddles rippling on the ground (although the YouTube video seems to have downgraded the resolution quite a bit).

Rain drops from sky

I came across a video on rain using Unity’s particle system.

Here is another tutorial which gets into splashes on the ground as well.

Oh, and another possibly useful video tutorial was on meteor fireballs. Okay, hot instead of water droplets, but might be useful for a rain effect as well…

In my video above, I created my own particle system as follows. I created a game object using the menu under “Effects / Particle System”. Here is the summary of the components I turned on for the particle system.

Emission controls things like how many particles are created per second. I found if I set this too high, it would run out of some buffer space causing a huge down pour, then nothing, then a down pour, then nothing. 2000 gave a fair few drops for me at a constant rate, at least on my own computer.

Next is the shape of the area that the particles will emerge from, like a cloud. I use a rectangular box, positioned with respect to the camera to cover the area required by the shot. The Y value is small as it is where rain drops emit from. They then fall to the ground.

Velocity over lifetime controls the speed of the raindrops. Here I used a Y value of -25 so the raindrops go downwards.

The rain looks more natural with some randomness.

Finally, how to render each raindrop. A few tutorials used a capsule shape, but I never managed to get it to look as good as I wanted. So instead I use a material of a circle that fades out to the edges. This softened the edges of the raindrops even when they catch the light of the lamps in the shot.

Here is the material settings I am using. Note that it is transparent, but you can experiment here for different values for whatever looks best to you.

Here is the texture for the material I used.

All up I was pretty happy with the result. Using the capsule shapes gave me much harder edges to the drops.

Rain on windows

I came across this tutorial on shader graph for rain drops down a surface. But my understanding does not actually refract the light. So you get light and dark (shadows), but no bulging of the image like you would with a magnifying glass effect.

I followed along and created working rain drops, but was not completely happy with them.

I ended up using the following package from the Unity asset store. I am still trying to tune it better though as the rain drops don’t come out as clearly as I would like. It feels like adding some slight fog to the glass where the raindrops are not would look a bit better.

Here is some raindrops on the glass. Not very clear. I can make the refraction greater, but it caused a duplicate image effect that I did not like much. So this one is still a work in progress for myself.

What irritates me the most is I found a great tutorial on coding shaders for the built in render pipeline. I loved the results it gave.

But, as I understand it, the approach cannot be used in HDRP! The old pipeline had a “grab buffer” that the shader could use to bend light that travelled through the glass surface. This allows a magnifying glass effect to be created per drop, not just adjusting normals so the light reflects differently. This buffer is not available in the newer shader graph. For that reason, you can do camera lens effects but not material effects inside a scene (like on a window pane). If this is wrong, I would love to know how to do it now! 

Ben Cloward has some great videos on effects, including a “rain drips on the lens post-processing effect” for shader graph. I was almost tempted to use this by removing the wall of the building from the camera shot, adding the lens effect, then superimposing a wall over the top in the video editing software. But I burned up the time budget I allocated myself for rain on windows and moved on.

Rain puddles on ground

Some of the above included the circular ripples of puddles on the ground. But I ended up using the partner of the above asset store. It worked well with minimal effort, including puddles of water.

I applied this shader to the tiles on the ground and layered a thin plane over the default tiles outside the school. Not perfect, but it got the shot done and looks pretty good in my opinion. (Although I just noticed zooming in for this screenshot I think I got the normals for the water reflection not scaled with the texture correctly! Lol!)

Another shot (the ripples are animated, which does not come out clearly on the screen shot)

Unity 2022.2 HDRP water

Unity has water support coming to HDRP in 2022.2. The RealToon shader shared a video on YouTube. This looks pretty good – you can see the refraction from the water clearly.

Some other tweets with little demos. This one is waves in the ocean.

This one is a ball in a swimming pool.

I have not yet looked to see if shader graph could do similar ripple effects, to see if I can get my raindrops bending light again for a more realistic feel. Some of the other shaders around seem to be able to do it, I just cannot work out how!

Other water effects of note

Someone else’s ocean water effect in Unity, including footprints in the sand at the beach!

Another asset store water effect

Unreal Engine also has some pretty impressive water support.

Unreal’s Niagara Fluids

More Unreal water examples

A very nice example of rain, clouds, and a wet umbrella in Unreal

An example of puddle ripples using shader graph (in Unreal, but I suspect very similar in Unity as well).

Another water effect was this tweet I came across on someone’s waterfall that looks pretty good.

Another waterfall example using Unity standard particle shaders

A blender wave shader

Puddles with raindrops in blender

Water, raindrops, all real time in blender!

Ever wanted to dance in the water?

Someone achieved a water effect with tiling in VRM files (which is the format VRoid Studio generates for characters)

And as a grand finale, want to see some truly amazing work? Sakura Rabbit on twitter produces some stunning results.

Raindrops on the skin (make the image big to see how good this really is!). I wish I could get this going on my models.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s