03: Draw a triangle
In this section, we will finally move on from lines to get to triangles, probably the most important shape in computer graphics.
There are a lot of variants on how to rasterize triangles, from different ways on how to determine the pixels to parallelization. We will use a very simple approach, that is nevertheless a good basis to understand more complicated algorithms. It is more or less the one presented in a very early paper by Juan Pineda [1].
You can find the full rasterization code here: Rasterizer 03
Juan Pineda. 1988. A parallel algorithm for polygon rasterization. In Proceedings of the 15th annual conference on Computer graphics and interactive techniques (SIGGRAPH '88). Association for Computing Machinery, New York, NY, USA, 17–20. https://doi.org/10.1145/54852.378457 ↩︎