# Water on camera lense effect

**URL:** <https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [July 2, 2014, 9:50am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964 "2014-07-02T09:50:25Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_44214bd2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_44214bd2](https://forums.unrealengine.com/u/anonymous_user_44214bd2)\
**Post date:** [July 2, 2014, 9:50am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/1 "2014-07-02T09:50:25Z")

</div>

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.

![4c8d4f14d573cf5adbba70e8bcdfa77fd8bc228c.jpeg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/c/8/4c8d4f14d573cf5adbba70e8bcdfa77fd8bc228c.jpeg)

---

<div class="post-metadata">

**Author:** ![Havoc](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/havoc/32/88710_2.png) [@Havoc](https://forums.unrealengine.com/u/Havoc)\
**Post date:** [July 2, 2014, 9:42pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/2 "2014-07-02T21:42:14Z")

</div>

is something I’ve thought about, though I haven’t had time to actually implement/figure out. I think 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.

---

<div class="post-metadata">

**Author:** ![Jacky](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jacky/32/918690_2.png) [@Jacky](https://forums.unrealengine.com/u/Jacky)\
**Post date:** [July 2, 2014, 10:41pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/3 "2014-07-02T22:41:39Z")

</div>

You should look into blendables and post process materials.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_32549598](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_32549598](https://forums.unrealengine.com/u/anonymous_user_32549598)\
**Post date:** [July 3, 2014, 12:10am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/4 "2014-07-03T00:10:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Legend286](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Legend286](https://forums.unrealengine.com/u/Legend286)\
**Post date:** [July 3, 2014, 10:49am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/5 "2014-07-03T10:49:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kylawl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kylawl](https://forums.unrealengine.com/u/kylawl)\
**Post date:** [July 7, 2014, 6:25am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/6 "2014-07-07T06:25:56Z")

</div>

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

Edit: is a postprocess effect.

 ![Screen Shot 2014-07-06 at 11.32.18 PM.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/1/f/1fb762a44a60c0d5328db7b81be3564b3f27c781.png)  
 ![normal.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/7/9/79ca5e010cbfa4ef965d4dcee5e2cf1a3b69c027.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6a4e1729](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6a4e1729](https://forums.unrealengine.com/u/anonymous_user_6a4e1729)\
**Post date:** [July 7, 2014, 7:22am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/7 "2014-07-07T07:22:27Z")

</div>

I’ve actually been looking into doing , 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 tutorial. Im going to mess around tonight and see if I cant make work in Gimp or PDN since those are the only programs I use for image editing.

EDIT: Forgot link:

---

<div class="post-metadata">

**Author:** ![kylawl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kylawl](https://forums.unrealengine.com/u/kylawl)\
**Post date:** [July 7, 2014, 4:33pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/8 "2014-07-07T16:33:29Z")

</div>

> [@Apple Slicer;91107](#):
>
> I found a cool tutorial on how to do the normal maps for the drops in photoshop.  
> …  
> 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.

---

<div class="post-metadata">

**Author:** ![scrcro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scrcro/32/1008648_2.png) [@scrcro](https://forums.unrealengine.com/u/scrcro)\
**Post date:** [July 7, 2014, 10:47pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/9 "2014-07-07T22:47:10Z")

</div>

I’ve been playing around with problem 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.

is the shading graph I’ve come up with:

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/5/2b5996a0cac7299ee1a52529b8dbd0b747d76dea.jpeg)  
However, there seems to be a problem with the way the Noise procedural and the SceneTexture interact, since I end up with :

 ![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/1/7b1bba0efc53bea8207f75c4c9f97316d9f583dd.jpeg)  
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 ?

---

<div class="post-metadata">

**Author:** ![scrcro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scrcro/32/1008648_2.png) [@scrcro](https://forums.unrealengine.com/u/scrcro)\
**Post date:** [July 9, 2014, 3:33pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/10 "2014-07-09T15:33:45Z")

</div>

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) evening.

 ![wet_lens.PNG](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/f/0fdbf0c31cae134dd33ce04d19f0ec22745dec2c.png)

---

<div class="post-metadata">

**Author:** ![EMcNine](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@EMcNine](https://forums.unrealengine.com/u/EMcNine)\
**Post date:** [October 27, 2014, 10:12pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/11 "2014-10-27T22:12:42Z")

</div>

Hi Crow87,

Could you please post the shading graph for 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.

Thanks!

---

<div class="post-metadata">

**Author:** ![scrcro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scrcro/32/1008648_2.png) [@scrcro](https://forums.unrealengine.com/u/scrcro)\
**Post date:** [October 28, 2014, 11:18am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/12 "2014-10-28T11:18:25Z")

</div>

> [@EMcNine;170648](#):
>
> Hi Crow87,
> 
> Could you please post the shading graph for 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.
> 
> Thanks!

Sorry, its been a while (and a few different workstations) since I last looked at ! 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 today

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_698516071](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_698516071](https://forums.unrealengine.com/u/anonymous_user_698516071)\
**Post date:** [October 28, 2014, 11:33am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/13 "2014-10-28T11:33:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AJUK](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@AJUK](https://forums.unrealengine.com/u/AJUK)\
**Post date:** [October 30, 2014, 5:11pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/14 "2014-10-30T17:11:37Z")

</div>

> [@;170865](#):
>
> I would appreciate it very much as well, if you found the time to look it up again. seems to be a very nice and interesting effect to have 🙂

I’d second that. 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 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0df12f74](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0df12f74](https://forums.unrealengine.com/u/anonymous_user_0df12f74)\
**Post date:** [October 30, 2014, 5:27pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/15 "2014-10-30T17:27:57Z")

</div>

> [@AJUK;172245](#):
>
> I’d second that. 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 🙂

And I will third it! 😛

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.

---

<div class="post-metadata">

**Author:** ![Ulrich.Thummler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ulrich.Thummler](https://forums.unrealengine.com/u/Ulrich.Thummler)\
**Post date:** [November 2, 2014, 4:54pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/16 "2014-11-02T16:54:53Z")

</div>

Hi kylawl,  
how do create nice rain normal?

---

<div class="post-metadata">

**Author:** ![kylawl](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kylawl](https://forums.unrealengine.com/u/kylawl)\
**Post date:** [November 2, 2014, 5:54pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/17 "2014-11-02T17:54:05Z")

</div>

> [@Ulrich.Thümmler;173423](#):
>
> Hi kylawl,  
> how do create 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.

---

<div class="post-metadata">

**Author:** ![Ulrich.Thummler](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ulrich.Thummler](https://forums.unrealengine.com/u/Ulrich.Thummler)\
**Post date:** [November 2, 2014, 10:10pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/18 "2014-11-02T22:10:03Z")

</div>

thank you 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_50a0b22d](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_50a0b22d](https://forums.unrealengine.com/u/anonymous_user_50a0b22d)\
**Post date:** [November 2, 2014, 11:03pm UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/19 "2014-11-02T23:03:18Z")

</div>

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.

> **[Noise](https://forums.unrealengine.com/showthread.php?49630-Noise)**
>
> Hi, I’m trying to understand how the Noise Utility node works I have made a simple Post Process material, when i connect a Noise node to the Emissive Color the noise renders in 3D space and is aligned to objects in my scene unlike a Texture Sampler...

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

---

<div class="post-metadata">

**Author:** ![scrcro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/scrcro/32/1008648_2.png) [@scrcro](https://forums.unrealengine.com/u/scrcro)\
**Post date:** [November 3, 2014, 10:56am UTC](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964/20 "2014-11-03T10:56:43Z")

</div>

> [@;173583](#):
>
> 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.

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.

> [@;173583](#):
>
> being said, I’d suggest not to use ddx/ddy for generating the normals due to the poor blocky results.

It does cause some hideous artefacts, 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 thread if/when that happens.

[Next page](https://forums.unrealengine.com/t/water-on-camera-lense-effect/6964.md?page=2)
