Perspective Interpolation FinishedAs promised, the perspective interpolation has been added. It took a little bit of reworking my rasterizer code, but it is up and running beautifully now. Here are the results:
It is quite a difference from the linear interpolation that I posted last time, shown here for comparison:
The perspective interpolation essentially takes the homogenous coordinates, and interpolates them based on the w-coordinates after the projection has been applied to the vertices (i.e. after the vertex shader). It must be done before the w-divide, or else the perspective interpolation yields the results of linear interpolation. It is really quite an interesting process - I would recommend looking into it if you are interested.
With perspective interpolation out of the way, next up is z-buffering. More to come on that next time...