# Depth blur and shorelines

**URL:** <https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222>\
**Category:** Rendering\
**Tags:** unreal-engine\
**Created:** [December 9, 2016, 1:33pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222 "2016-12-09T13:33:42Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![1User12](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1User12](https://forums.unrealengine.com/u/1User12)\
**Post date:** [December 9, 2016, 1:33pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/1 "2016-12-09T13:33:42Z")

</div>

![Screenshot_7.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/f/8/f8f3e6bcd865e53efa3dc0babd31f940b6f51d12.png)

Is there any way to add more and more blur the deeper the object is underwater?

Also, I tried to add shorelines (Const B is 300):

 ![Screenshot_9.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/4/6/46d80a5b3079a00d6de71bd0a1475b57a1c06ec9.png)

But this is what I ended up getting:

 ![Screenshot_8.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/a/a/aae5c2335962995412c8f3e8166e47aed575bbda.png)

No matter the value I give B, the result is the same.

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [December 9, 2016, 4:05pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/2 "2016-12-09T16:05:11Z")

</div>

you can blur objects behind translucency using spiral blur node

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![NuclearPhoenix](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@NuclearPhoenix](https://forums.unrealengine.com/u/NuclearPhoenix)\
**Post date:** [December 9, 2016, 5:35pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/3 "2016-12-09T17:35:29Z")

</div>

In terms of adding more blur the deeper an object is, I can think of three ways:

1. More blur the farther the object is from the camera (just using scene depth), this is the least accurate for what you want, but very easy

2. More blur the farther the object is below the surface of the water, using Z position. This is pretty close to what you want. However, it’s not entirely accurate because viewing an object from directly above will have the same amount of blur as viewing it from an large angle, and even though there’s more water between the camera and the object when viewed at an angle, the blur would be the same.

3. More blur based on the amount of water that the light must pass through. Hardest and highest cost in the shader, because you would need to calculate the distance to the surface of the water and to the surface of your object at each pixel. Off the top of my head, you could use the custom depth buffer and place the water and object in different channels for this, but there may be a more efficient way of doing this.

Here’s an excellent article from the esteemed Tom Looman on custom depth buffers: [http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/](http://www.tomlooman.com/the-many-uses-of-custom-depth-in-unreal-4/)

---

<div class="post-metadata">

**Author:** ![RyanB](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyanB](https://forums.unrealengine.com/u/RyanB)\
**Post date:** [December 9, 2016, 10:02pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/4 "2016-12-09T22:02:39Z")

</div>

You plugged vertex normal into the “Distance from nearest surface”.

Vertex normal is a normalized value meaning a length of 1. That means you are looking up all your values within a 1cm circle at 0,0,0. Assuming you don’t want that, you should use WorldPosition there instead of VertexNormal. You cannot scale it either or it will be sampling from different locations. Scaling occurs after the sample.

---

<div class="post-metadata">

**Author:** ![1User12](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@1User12](https://forums.unrealengine.com/u/1User12)\
**Post date:** [December 16, 2016, 12:38pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/5 "2016-12-16T12:38:53Z")

</div>

> [@redbox;635591](#):
>
> you can blur objects behind translucency using spiral blur node  
> [A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums](https://wiki.unrealengine.com/How_To_Use_The_Spiral_Blur_Material_Node)

I followed the example but for some reason it is blurred only on one side

 ![Screenshot_3.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/e/2/e27bc096844695dc9fc0238d9c982502da7af732.png)

---

<div class="post-metadata">

**Author:** ![redbox](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@redbox](https://forums.unrealengine.com/u/redbox)\
**Post date:** [December 16, 2016, 1:32pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/6 "2016-12-16T13:32:00Z")

</div>

it can’t be blurred only on one side.  
This node works for whole surface.  
Maybe you use some additional masking with this node?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_050222471](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_050222471](https://forums.unrealengine.com/u/anonymous_user_050222471)\
**Post date:** [July 10, 2021, 1:00am UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/7 "2021-07-10T01:00:43Z")

</div>

> [@NuclearPhoenix](#):
>
> 1. More blur the farther the object is from the camera (just using scene depth), this is the least accurate for what you want, but very easy

Please, how??? This is EXACTLY what I’ve been looking for, for weeks, and haven’t been able to find something that works.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [July 10, 2021, 7:02pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/8 "2021-07-10T19:02:24Z")

</div>

In a 5 year old thread? Really?

Today, just use single layer water.  
It should do everything for you including the opacity by depth.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_050222471](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_050222471](https://forums.unrealengine.com/u/anonymous_user_050222471)\
**Post date:** [July 13, 2021, 5:29pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/9 "2021-07-13T17:29:40Z")

</div>

> [@MostHost\_LA](#):
>
> In a 5 year old thread? Really?
> 
> Today, just use single layer water.  
> It should do everything for you including the opacity by depth.

Well I haven’t gotten any replies in newer threads, so I am looking through everything I can try and find. So yes, really.

It isn’t working for me. But I am also attempting to use it slightly different.

I am underwater and need the blur to increase with distance away from the player.

I think the option 1. that NuclearPhoenix mentioned would work perfect for me. He says it is “very easy” but I’m struggling to find out how.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [July 13, 2021, 6:56pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/10 "2021-07-13T18:56:30Z")

</div>

So what you are doing has nothing to do with actual water rendering either.

Look into volumes and post process effects to get what you need.

[![](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/8/9/f891ee983a6543ac20c48f5e001c5b7d3ef51dcf.jpeg "Unreal Engine 4 How To Create Underwater Effects (Part 1 of 4)") ](https://www.youtube.com/watch?v=8jbK00s2tKg)

6:53

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_050222471](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_050222471](https://forums.unrealengine.com/u/anonymous_user_050222471)\
**Post date:** [July 21, 2021, 7:52pm UTC](https://forums.unrealengine.com/t/depth-blur-and-shorelines/80222/11 "2021-07-21T19:52:45Z")

</div>

The effect should be the same as how water works irl.

I’ve only been able to find post-processings that equally blur, not based on depth.
