Software Renderer

This is a 3D renderer that doesn’t use the GPU at all; it does all the triangle math manually on the CPU and individually sets the color of each pixel shown onscreen. This was a fun experience learning a bit about how 3D graphics work. I only use “fast” operations while rasterizing the triangles (i.e. no floating-point division).

I looked up how to draw 2D lines but had to figure out the rest on my own.


(with music from The Smurfs’ Nightmare)


Check out this twitter thread showing my step-by-step progress, from individual triangles all the way up to a lit 3D scene!


The teapot is made of 3752 triangles / 1976 vertices, and the renderer runs at around 5ms per frame. I haven’t done the research to figure out how good that really is (and I haven’t attempted to optimize the renderer, beyond my “fast math” design restrictions) but I can spin this particular teapot around at 60fps with plenty of time to spare :)