Home

zbuffer

A z-buffer, also known as a depth buffer, is a per-pixel storage used in 3D rendering to record the depth of the closest object at each image sample. It is essential for hidden-surface removal, enabling the renderer to determine which surfaces are visible from the camera.

During rasterization, each generated fragment yields a depth value z. This value is compared against the current

Depth buffers are usually paired with a color buffer and can use various bit depths, commonly 16,

Hardware implementations perform the depth test in parallel on the GPU and may include early depth testing

Limitations of z-buffering include finite precision leading to artifacts, and memory usage proportional to the display

value
stored
in
the
depth
buffer
for
that
screen-space
location.
If
the
new
fragment
is
closer
to
the
camera
(typically
a
smaller
depth
value,
using
a
0–1
range),
the
depth
buffer
is
updated
and
the
fragment's
color
is
written
to
the
color
buffer;
otherwise
the
fragment
is
discarded.
The
process
is
repeated
per
frame,
with
the
depth
buffer
cleared
at
the
start.
24,
or
32
bits.
Depth
values
are
often
stored
non-linearly
after
projection,
which
concentrates
precision
near
the
near
plane.
Improper
choice
of
near
and
far
planes
can
cause
z-fighting,
where
two
surfaces
at
similar
depths
compete
for
visibility.
to
avoid
shading
fragments
that
fail
the
test.
Some
systems
use
additional
techniques
such
as
a
hierarchical
or
logarithmic
depth
buffer
to
improve
performance
and
precision.
resolution.
Despite
limitations,
z-buffering
remains
a
standard
approach
for
real-time
3D
rendering
due
to
its
generality
and
efficiency.