Water on camera lense effect

Anyone know of an existing solution for showing rain/water-on-camera-lense effect?

Would be cool if it was possible to have directional based as well so when you look west the camera gets sprayed while it gradually dries looking in a different direction.


This is something I’ve thought about, though I haven’t had time to actually implement/figure out. I think this could be done in a couple of ways, though material function might be the best route. Create a plane that is only visible to the player, apply the material function with the effect, and set up a timer to destroy the plane.

I could totally be wrong, though. It’d be great to hear other ideas as well.

You should look into blendables and post process materials.

I know Hourences includes tutorials on glass cracking and blood splattering on the screen, in his Solus course. I don’t have the files handy to check over it, at the moment, however.

Though, I believe he had them setup in a similar fashion to Havoc’s suggestion. So it’s probably worth looking into that.

Screenspace particles with a refractive shader should be fine for what you want, the only thing you really need to do is make some normals for the droplets which shouldn’t be too difficult if you have a DCC tool to bake them out from.

Try something like this with this normal map I found on the internet. Should be enough to get you started.

Edit: This is a postprocess effect.

1 Like

I’ve actually been looking into doing this as well, but I would like to have the drops running down the screen (from it raining outside, ect)

I found a cool tutorial on how to do the normal maps for the drops in photoshop. I am yet to find out how to make the drops animate however. But check out this tutorial. Im going to mess around tonight and see if I cant make this work in Gimp or PDN since those are the only programs I use for image editing.

EDIT: Forgot link:

That is a good video for doing the drops. As far as the post effect goes, definetly start with what I posted there, that will get you going. The animated stuff should be a cake walk.

I’ve been playing around with this problem this evening, specifically trying to make it as procedural as possible - i.e. not having to rely on animated textures to do the droplet formation and dissipation.

This is the shading graph I’ve come up with:

However, there seems to be a problem with the way the Noise procedural and the SceneTexture interact, since I end up with this:

Its odd, all the droplets are aligning themselves to the normals of the objects in the scene, not the camera… Any ideas how to get around this?

Nevermind, managed to fix the noise problem. Here’s a quick still of a simple wet-lens shader, driven entirely by procedurals. I’ll post the shading graph once I’ve added in the blurring and dispersion caused by the droplets, as well as the directional controls (angle between player and rain direction controls the sliding on the glass, as well as the number of raindrops on the lens) this evening.

Hi Crow87,

Could you please post the shading graph for this effect? Are there any new developments on it? I have followed what you posted but the water drops are all aligning to the objects instead of the camera lens.


Sorry, its been a while (and a few different workstations) since I last looked at this! I can’t remember off the top of my head what I did to change it, I’ll try and dig up my scene file if I get a chance today

I would appreciate it very much as well, if you found the time to look it up again. This seems to be a very nice and interesting effect to have :slight_smile:

I’d second that. This rain on lens effect is exactly what I’m trying to achieve for my current unreal scene. If you could post your process that would be fantastic :slight_smile:

And I will third it! :stuck_out_tongue:

The procedural approach shown by Crow87 would be ideal so any info on how you got around the limitation would be great! I have also recreated kylawl’s approach and it looks great as well, but I like the idea of a procedural system.

Hi kylawl,
how do create this nice rain normal?

I just grabbed it from google images, but I would probably start plopping down dots in photoshop then using liquify to smear them and distort then. Then use the nvidia normal map tools to convert the height map to a normal map.

thank you :slight_smile:

For anyone trying the procedural approach posted by crow87, you need to use screen coordinates for the noise node’s position input. By default the noise is based on world position coordinates which is why it’s aligned to the geometry instead of the screen.

This being said, I’d suggest not to use ddx/ddy for generating the normals due to the poor blocky results.

Thanks for answering these guys. I’ve been working a 100 hour week at work, so haven’t had time to even move back to my old workstation, let alone open up an old test project.

It does cause some hideous artefacts, this is very true. I had wanted to explore a different solution for generating the normals, but didn’t have much luck with the heightToNormals node. Given some more time (and the fact I need to get it working for Cassini), I’ll probably figure it out. I’ll update this thread if/when that happens.