Scan-Line Algorithm:
This image-space method for eliminating hidden surfaces is an extension of the scan-line algorithm for filling polygon interiors. Rather than filling just one surface, now we deal with multiple surfaces. As each of the scan line is processed, all of the polygon surfaces intersecting that line are examined to find out which are visible. Across each of scan line, depth calculations are made for each overlapping surface to find out which is nearest to the view plane. When the visible surface has been find out, the intensity value for that position is entered into the refresh buffer.
We consider that tables are set up for the several surfaces, which include both an edge table and a polygon table. The edge table contains coordinate end points for each line in the scene, the inverse slope of each line, and pointers into the polygon table to recognize the surfaces bounded by each of line. The polygon table contains coefficients of the plane equation for each surface, intensity information for surfaces, and probably pointers into the edge table. To facilitate the search for surfaces crossing a given scan line, we may set up an active list of edges from information in the edge table. This active list shall contain only edges that cross the current scan line, sorted in order of enhancing x. additionally, we define a flag for each surface that is set on or off to indicate whether a position along with a scan line is inside or outside of the surface. Scan lines are processed left to right. On the leftmost boundary of a surface, the surface flag is turned on; and at the rightmost boundary, this is turned off.
It illustrates the scan-line method for locating visible portions of surface for pixel positions along with the line. The active list for scan line 1 contains information from the edge table for edges AB and BC, just the flag for surface S1 is on. Thus, no depth calculations are necessary, and intensity information for surface S1 is entered from the polygon table into the refresh buffer. Likewise, among edges EH and FG, just the flag for surface S2 is on. No other positions along scan line 1 intersect surfaces, thus the intensity values in the other areas are set to the background intensity. The background intensity may be loaded throughout the buffer in an initialization routine.