For each scan line perform from step (1) to (3).
1) For all pixels on a scan-line, arrange depth [x]=1.0 i.e. max value and Intensity [x] = background-color.
2) For each polygon means, get all pixels on the current scan-line as S1 that lies inside the polygon. For all of these x-values:
a) Compute the depth z of the polygon at (x,y)
b) If z < depth [x], set depth [x] =z and intensity consequent to the polygon's shading.
3) When all polygons have been identified; the values comprised in the intensity array present the solution and can be a duplicate in the frame-buffer.