World Code Z

Z-Buffering is now the universal solution to Visible Surface Determination‎. When rendering each pixel is checked against the existing depth value. If the current pixel is further away the pixel is rejected, otherwise it is shaded and it's depth value will replace the one in the z-buffer. So drawing things closer to the camera first lowers the amount of pixel shader work that need to be done.

The Z Tests

There are up to three tests Z-test running at a GPU depending on settings. The last one is the common one talked about when describing a rendering pipeline. The two other exist to reject any extra unneccesery work as soon as possible

Hierarchical Z-Buffer

The GPU split up the Z-buffer in tiles and for each tile it keep track of the depth value. It makes it possible to use it as a low resolution depth buffer so it does not have to touch the real depth buffer unless a triangle has a chance to pass the depth test.


Normally the depth test is run after the pixel shader. With Early-Z the GPU can run the test before executing the pixel shader. The upside of this is the ability to skip running what can be a expensive pixel shader unless it needs to. Early-Z only works if one avoids modifying the z value in the pixel shader. Early-Z is used in Z pre-pass.

Late Z

This is the depth test run after pixel shaders has run.

Z Bandwith

Z Compression

This is reduce the bandwidth used when reading and writing to the depth buffer. It splits the buffer into tiles and track the state as cleared, compressed or uncompressed.

Fast Z Clear

When using Z Compression the buffer can be cleared quicly by setting all tiles to cleared.


Depth - 2020

to z-prepass or not to z-prepass - 2020

Quantitative Analysis of Z-Buffer Precision - 2020

Hierarchical Depth Buffers - 2020

Improved normal reconstruction from depth - 2019

TL;DR of the paper 'Conservative Z-Prepass for Frustum-Traced Irregular Z-Buffers' - 2018

Delta Color Compression Overview - 2016

Depth Precision Visualized - 2015

Maximizing Depth Buffer Range and Precision - 2012

Creating Vast Game Worlds - 2012

Tightening the Precision of Perspective Rendering - 2012

Depth in-depth - 2012

Maximizing Depth Buffer Range and Precision - 2012

A trip through the Graphics Pipeline 2011, part 7 - 2011

Know your Z - 2010

Attack of the depth buffer - 2010

A couple of notes about Z - 2009

Linearized Depth using Vertex Shaders - 2006

Using W-Buffers for Improved Depth Resolution - 2005

Learning to Love your Z-buffer

Tutorial 35: Depth Buffer

Split-free occlusion sorting