Depth API Material Graph
Updated: Sep 4, 2024
For use cases other than occlusions, you can access the depth texture via the material graph. Use the
Environment Depth expression to sample the depth texture. Depth is returned in world units (centimeters by default). It works in the same way as the
SceneDepth.
This opens up the door for other interesting use cases other than occlusion.
First example gets the environment depth and maps it to the Hue of a color, thus making it change based on distance.
Second example gets the environment depth and scene depth and compares the distance. If the environment is further it renders red otherwise it renders blue.