Depth buffer / Z-buffer
A hidden grayscale image storing how far away every pixel is, so the GPU knows what is in front and what gets covered up.
See it
What it is
Alongside the color image it is painting, the GPU keeps a second, invisible image: one number per pixel recording how far away the closest thing drawn there is. Every new fragment tests its depth against that stored value and is thrown away if something nearer already claimed the pixel. That single trick is why you can hand the GPU your meshes in any order and still get correct occlusion, no sorting required. Visualized, it looks like a grayscale image where near is white and far is black.
It runs by default, so you notice it when you start turning parts of it off (depthTest and depthWrite on a material) or when you read the depth texture in a post-processing pass. Ambient occlusion, fog, depth of field, soft particles, and outline effects are all just math on the depth buffer.
Two classic failures. Transparency breaks it: a glass panel that writes depth blocks everything behind it, so blended materials usually need depth writing switched off by hand and get sorted back to front instead, which is exactly where the glass-through-glass glitches come from. Precision is not uniform: depth values are packed densely near the camera and sparsely far away, so a tiny near plane paired with an enormous far plane leaves distant coplanar surfaces fighting over the same value and flickering (z-fighting). Tighten the camera's near and far range first, since that fixes the precision-driven kind outright. Surfaces that are genuinely coplanar, like a decal sitting exactly on a wall, still need real separation, polygon offset, or one of the two faces deleted.
Ask AI for it
Fix the render order in this three.js scene using depth buffer settings rather than reordering objects: keep depthTest on everywhere, set depthWrite false on the transparent glass materials and give them explicit renderOrder so they draw back to front after all opaque geometry. Then raise the camera's near plane from 0.001 to 0.1 to recover depth precision and kill the z-fighting on the coplanar floor decals. Add a debug toggle that renders the depth texture as a grayscale overlay so I can see what the GPU sees.