The Warnock algorithm is a hidden surface algorithm developed by John Warnock that is classically used in graphics (for example to create a 3D configurator). It explains the problems of displaying a difficult image by recursively subdividing a view until areas are reached that are trivial to evaluate. If the view is easy to calculate, it will be rendered as well. Otherwise, it will be split into tiny parts, which are also evaluated for simplicity. This is an algorithm with the runtime of O(np), where p is the number of pixels in the viewport and n is the number of polygons.

The input for the Warnock algorithm are details of polygons and a viewport. A positive case is when the details of polygons are very simple and the polygons are created in the Viewer. The continuous step is to split the Viewer into four equal quadrants and recursively identify the algorithm for each quadrant, modifying a polygon list to contain polygons recognizable in that quadrant.

- Initialize the area.
- Create a list of polygons by sorting them by their Z values.
- Remove polygons that are outside the range.
- Identify the relationship of each polygon.
- Perform the visibility decision analysis:
- Fill the area with the background color if all polygons are disjunct,
- Fill the entire area with background color and fill part of the polygon if there is only one polygon contained,
- if there is a single surrounding polygon, but it is not included, then fill the area with the color of the surrounding polygon.
- Sets the pixel to the color of the polygon that is closer to the area of the pixel (x, y) you want to view, and if none of (a) to (d) applies, calculates the z coordinate at the pixel (x, y) of the polygon.

- If none of the above points is correct, divide the area and continue with the second step.

So far we are with our contribution to the “Warnock Algorithm” and hope that you could gain a first short insight into the topic.

Thank you very much for your visit.

## Leave A Comment