Depth blur and shorelines

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):

But this is what I ended up getting:

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

1 Like

you can blur objects behind translucency using spiral blur node

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/

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.

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

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

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

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.

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.

6:53

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.