The Warnock algorithm is a hidden surface algorithm developed by John Warnock that is classically used in the area of graphics. It explains the issues of rendering a difficult image by recursive subdivision of a view until regions are attained that is trivial to evaluate. Similarly, if the view is simple to compute effectively then it is rendered; else it is split into tiny parts which are likewise evaluated for simplicity. This is a algorithm with run-time of O(np), where p is the number of pixels in the viewport and n is the number of polygons.
The inputs for Warnock algorithm are detail of polygons and a viewport. The good case is that if the detail of polygons is very simple then creates the polygons in the viewport. The continuous step is to divide the viewport into four equally sized quadrants and to recursively identify the algorithm for each quadrant, with a polygon list changed such that it contains polygons that are detectable in that quadrant.
Fig.3.5. Warnock algorithm
1. Initialize the region.
2. Generate list of polygons by sorting them with their z values.
3. Remove polygons which are outside the area.
4. Identify relationship of each polygon.
5. Execute visibility decision analysis:
a)Fill area with background color if all polygons are disjoint,
b)Fill entire area with background color and fill part of polygon contained in area with color of polygon if there is only one contained polygon,
c) If there is a single surrounding polygon but not contained then fill area with color of surrounding polygon.
d)Set pixel to the color of polygon which is closer to view if region of the pixel (x,y) and if neither of (a) to (d) applies calculate z- coordinate at pixel (x,y) of polygons.
6. If none of above is correct then subdivide the area and Go to Step 2.