The Warnock algorithm is a hidden surface (hidden line) removal algorithm in computer graphics, invented by John Warnock and typically used to render three-dimensional scenes. It solves the problem of rendering a complicated image by recursively subdividing a scene until areas are obtained that are trivial to compute. If a given region of the scene is simple enough to compute efficiently, it is rendered; otherwise, it is divided into smaller parts that are likewise tested for simplicity.
History and Origin
The algorithm was developed by John Warnock as part of his doctoral work at the University of Utah. It was described in his 1968 technical report, A Hidden Line Algorithm for Halftone Picture Representation, and subsequently in his 1969 doctoral thesis, A Hidden Surface Algorithm for Computer Generated Halftone Pictures. Warnock expressed the algorithm in words and pictures rather than software code, and the core thesis was approximately 26 pages from introduction to bibliography. The work also described protocols for shading oblique surfaces and other features now central to three-dimensional computer graphics.
Method
The Warnock algorithm is a divide-and-conquer approach. Its inputs are a list of polygons (typically planar, describing objects in three-dimensional space) and a viewport on the viewing plane. The algorithm operates as follows:
- If the list of polygons in the viewport is "simple," the polygon or portion of the polygon is drawn in the appropriate part of the viewport. "Simple" is generally defined as containing one polygon or reaching a viewport that is one pixel in size.
- If a viewport reaches one pixel in size, that pixel is assigned the color of the polygon closest to the observer.
- Otherwise, the viewport is split into four equally sized quadrants, and the algorithm is called recursively on each quadrant, with the polygon list modified to contain only polygons visible in that quadrant.
For each square (window) being examined, the algorithm classifies its relationship to the polygons. Three basic relationships are considered between a square and a polygon:
- The square is wholly outside the projected polygon ("out").
- The square contains some edge or vertex of the polygon ("involved").
- The square is wholly inside the projected polygon ("enclosing").
Subdivision of a square is avoided (termination) when one of two conditions holds: either all polygons are outside the square (so the square "sees" nothing), or a single "enclosing" polygon is found that hides all other polygons within the square (i.e., it is closer to the observer than all other relevant polygons).
Key Properties
- Area coherence: The algorithm exploits area coherence—the property that visible surface features in a scene tend to be spatially coherent—by focusing computation only on complex regions while skipping over simple, uniform areas.
- Complexity: The algorithm has a reported run-time of O(np), where n is the number of polygons and p is the number of pixels in the viewport.
- Image-space / object-space hybrid: The Warnock algorithm combines aspects of object-space and image-space methods, as it analyzes polygon relationships in screen space while recursively subdividing the viewport.
Significance and Context
The Warnock algorithm was one of the foundational approaches to hidden surface removal and influenced the later development of related visibility algorithms. It was proposed during a period (late 1960s to late 1970s) of intense research into efficient hidden surface determination, when framebuffer memory was extremely expensive. The approach of "if the situation is too complex, subdivide" has recurred across computer graphics, and Warnock's work is recognized as a classic solution to the visibility problem.
The algorithm is also discussed in standard computer graphics literature, including the Oxford Dictionary of Computing, and is frequently presented in textbooks and university courses alongside other visibility techniques such as the painter's algorithm, z-buffering, and binary space partitioning (BSP) trees.