Everything I learnt while building a rasterization engine.

Jan 2, 2024

I truly believe that the two best ways to learn something are by doing/using that thing or by building that thing. I was literally just scrolling twitter before bed one sunday night and I saw some game devs arguing about something. I don’t even remember what they were arguing about, but that day I realized I had never done anything with computer graphics. In my mind it was one of those “hard tech” domains of software; grouped in with operating systems, kernels and stuff. And I was also on the lookout for something exciting I could do with C++. I had learned C over the summer and the programming course in uni was in C++. So I figured why not go all-in and just build a 3d renderer! This post contains notes and stuff I learnt while building the rasterizer.

It’s a lot of unfiltered thought and some of the math may be formally wrong (beware!) but I’ve tried to leave some intuitive explanation so that I myself could implement it in code.

Drawing Straight lines

Filling in triangles

Hidden face removal.

Texture mapping

Homogenous Coordinates

Convo with chatgpt where it finally kinda clicked.

ModelView matrix

Shaders

The part that calculates lighting, color and stuff for a scene.

Vertex shader:

Other resources:

Some Images:

image

image

image

image


Building Tiviem [0]

Have a comment or response? Email me.