Depth Buffers and Rasterization Order

Keep the nearest fragment at each sample and distinguish correct ordering from finite-precision depth representation.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. A depth test maintains the closest accepted sample
  2. Perspective and precision affect which values can be distinguished

A depth test maintains the closest accepted sample

Rasterizing a triangle produces candidate fragments at covered sample positions. Under an ordinary convention where smaller depth is closer, keep a fragment only when it beats the stored depth, and update both stored depth and associated output. Initializing to the farthest allowed value permits the first visible fragment. With exact values and a consistent tie rule, opaque rendering can select the nearest surface independently of traversal order.

Perspective and precision affect which values can be distinguished

The stored depth may be a nonlinear function of distance. Nearly coincident surfaces can round to indistinguishable depths, leading to unstable visual ordering. Transparent surfaces also need compositing rules beyond selecting one opaque sample. Perspective interpolation handles attributes across projected triangles. Alpha compositing describes color contributions from multiple layers.[1][2]

References

  1. Matt Pharr, Wenzel Jakob and Greg Humphreys, Physically Based Rendering ↩
  2. Richard Szeliski, Computer Vision: Algorithms and Applications ↩