Intermediate Topic 21 of 49 Graphics, Vision & Media
Z-Buffer
Per-pixel depth test resolving visibility.
How it works
The Z-buffer, or depth buffer, stores a depth value for every pixel, so the renderer can decide which surface is closest. When a fragment is drawn, its depth is compared with the stored value: if closer, it overwrites color and depth; otherwise it is discarded. This resolves hidden-surface removal without sorting triangles, in any draw order. Depth is stored non-linearly after perspective projection, with more precision near the camera, and formats are typically 24 or 32 bits.
Where it is used
All real-time 3D engines use depth buffers, and techniques such as shadow mapping, depth of field and screen-space effects reuse depth information.
Common pitfall
Z-fighting occurs when two surfaces are nearly coplanar or far from the camera and precision is insufficient, causing flickering. Transparent objects need sorting because depth writes block objects behind them. A near plane too close to the camera wastes precision. Use reversed-z with floating-point depth, tighten the near and far range and offset decals with depth bias.
Where it fits in the course
Z-Buffer is topic 21 of 49 in Graphics, Vision & Media, rated Intermediate. It follows Rasterization. The next topic is Shading Models.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Graphics, Vision & Media quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Graphics, Vision & Media quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Z-Buffer?
Where do people use Z-Buffer?
What is the most common mistake with Z-Buffer?
What should I learn before this topic?
How can I practice it?
Is Z-Buffer hard to learn?
How long does it take to learn Z-Buffer?
Which topics are related to Z-Buffer?
What should I study after Z-Buffer?
Related topics
- Rasterization (Graphics, Vision & Media)
- Shading Models (Graphics, Vision & Media)
- Rendering Pipeline (Graphics, Vision & Media)
- Texture Mapping (Graphics, Vision & Media)
- Buffer Overflow (Security & Cryptography)
- Circular Buffer (Data Structures)