Scan Line Coherence Algorithms in computer graphics

Scan line algorithms solve the hidden surface problem, one scanline at a time. They traverse the picture the picture space from top to bottom, one line at a time removing all the hidden surface along that scan line.

The simplest of them can be the depth buffer algorithm itself. Since the algorithm has to consider every pixel, it can take care of pixels along each scan line at a time and then go to the next line and so on

Scan line coherence algorithm:

For each scan line perform the following steps.

a. For every pixel on a scan line, set depth value to 1.0 and intensity to the back ground value.

b. For each polygon in the view scene, find all pixels of the scan line under consideration that lie within the polygon. For each of them

i. Find the depth z of the polygon at the point.

ii. If Z < depth [x], set depth[x] to z and the intensity to the intensity of the polygon

c. Once all polygons have been taken care of, the pixels contain the intensity values that are to be displayed. This algorithm when used in conjunction with Y-X scan conversion forms the simplest of scan line coherence algorithms.