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.

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:

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?