Scanline rendering - Bilinear interpolation

1Scanline rendering

The method starts by sorting edges of projected polygons inserted into two tables: one for left edges and one for right edges. The rasterizer maintains an active edge table which always point the current left and right edges delimiting the polygon sides. The Y coordinate is scaned from Ymin to Ymax and active edge table is updated each time Y is outside of (one or two) active edges.

 

2Bilinear interpolation

For each Y value we scan the horizontal line of pixels and draw them according to their visibility, color, and so on.

That means that for each Y value we must interpolate Xmin and Xmax inside the current left and right edges. We interpolate also texture coordinates, light intensity and Z value (other parameters can be interpolated).

Finally, to draw the pixels of each horizontal line we interpolate once again these values to obtain pixels' properties.

This implies to interpolate twice each value (one interpolation for vertical scan and other one for horizontal scan).

To reduce computation time I use fixed point operations and incremental algorythm.