What it does

The Depth Buffer stores surface depth at screen locations. ZTest compares new geometry with stored depth, and ZWrite updates it. This lets nearer objects hide surfaces behind them.

Figure: Conceptual relationship: Surface depth → Depth buffer → Later visibility tests
Figure: Conceptual relationship: Surface depth → Depth buffer → Later visibility tests

How to use it

ZWrite stores depth on a render target and ZTest compares later fragments against it. A sampled depth texture can be copied or generated separately.

A concrete example

Z-fighting between nearly coincident planes requires investigating precision and geometry overlap. Disabling depth can hide the symptom while breaking wall occlusion.

How to check it

  1. Inspect clipping ranges and surface separation.
    Testing and writing are separate settings
    Testing and writing are separate settings
  2. Because transparent materials may not write depth, compare the visible image with the actual depth contents.
    Testing and writing are separate settings
    Testing and writing are separate settings

Limitations

A sampled depth texture is not always the same resource/workflow; inspect precision and projection.

References