Smoother DepthFade

Hi,
how can I make smoother DepthFade effect in Materials? It has only 2 inputs: Opacity and FadeDistance and it has of course alpha and fade but I want to have this even smoother. Is it possible?

Thank you,

&d=1406494276

You can re-make depthfade using the following node configuration, and you have much more control this way.

The “depth” in “depthfade” is meant to be “screen depth”, not “vertical depth”. You’ll not be able to get the effect you want from it unless the camera is looking straight down into the water surface. The way I know games do this is by generating a pre-calculated height map from a top-down view that fits the entire playable area and sampling it on the water surface material to control the alpha while using a large distance screen depth fade for dynamic objects.

In the video two posts above, on the nodegraph it shows to use scene depth and pixeldepth, just replace those two inputs with world position Z and world position behind translucent Z and it should achieve what you’re looking for.

is there a way to capture the second ray hit and use that? like where the first hit is the water surface and the second would the be the surface being refracted and take that distance and encode as a scalar value and use for the depth fading? I would think it would work but precalulations would prolly be much more efficient.

I wouldn’t bother trying to precompute it, there’s not much gain as you’re still doing checks between the water and scene anyway. Did you try use both world Z and World Z behind translucent nodes to get the effect you wanted?

Alternatively I suppose if you’re not bothered about dynamism, you could just create your water surface in 3ds Max to fit your terrain and add a couple of edge loops around the shoreline and vertex paint it to fade out, which would be very fast compared to doing it real time.