Every time a GPU draws a 3D scene, it faces a question millions of times per frame: which surface is closest to the camera at this pixel? Everything behind that surface must be hidden. Get it wrong and a distant mountain pokes through a wall, or a character's arm floats in front of their face.
Before the mid-1970s, the standard answer was the painter's algorithm: sort every polygon by depth, then paint them back-to-front so closer ones cover farther ones. It sounds reasonable, until two polygons overlap each other cyclically — a situation that simply has no valid painting order.
In 1974, Edwin Catmull proposed a radical simplification: forget sorting the whole scene. Instead, keep a depth value (the -coordinate) for every pixel on screen. Each time a surface covers a pixel, compare its depth against the stored value. If it is closer, update the pixel's color and its stored depth. If it is farther, discard it. One array of numbers — the z-buffer — replaces all that sorting, and hidden-surface removal becomes an per-pixel test rather than an sort.
That insight is now baked into every GPU ever made.
Comments
Loading comments...