Skip to main content

The Depth Fade Node

Soften the edges where translucent surfaces meet opaque geometry with the Depth Fade material node.

Published Updated |
Materials
graphic

Use the Depth Fade node to add depth blending to your world. It fades a translucent surface out as it gets close to the geometry behind it, which makes it very useful for blending the intersection between meshes, water depth, fading an area to black, pseudo-fog, and more.

How does it work?

Depth Fade compares how far away the surface being drawn is with how far away the scene behind it is. The output is 0 where the two touch and ramps up to the input opacity over the fade distance.

Result = Opacity * saturate((SceneDepth - PixelDepth) / FadeDistance)

Plot of Depth Fade output against SceneDepth minus PixelDepth. With the defaults, Opacity 1.0 and FadeDistance 100, the output rises linearly from 0 to 1 over 100 centimeters and stays at 1. FadeDistance 50 and 200 end the ramp at those distances.

Plug the result into the material’s Opacity input.

InputDefaultDescription
Opacity1.0The opacity to scale by the fade. The OpacityDefault property is used when the pin is unconnected.
FadeDistance100The world space distance, in centimeters, over which the fade happens. The FadeDistanceDefault property is used when the pin is unconnected.

Frequently asked questions

Why won’t my material compile?

Depth Fade reads scene depth, so it only works in translucent and post process materials. Opaque and masked materials fail to compile with Only transparent or postprocess materials can read from scene depth.

Can I use it with Output Depth and Velocity?

No. A translucent material with Output Depth and Velocity enabled writes to the depth buffer, so you’ll have to pick one or the other.

Does it behave differently on mobile?

Slightly. On mobile feature levels, scene depth tops out at 65500, so the node clamps the surface’s depth to avoid distant objects fading out when they shouldn’t.

Check out the following resources to learn more about the subject.

Unreal Directive is free and ad-free.

If it saved you time, you can help keep it that way.

Donate