r/GraphicsProgramming • u/yetmania • Sep 07 '25
CPU Software Rasterization Experiment in C++
Inspired by Tsoding's post about Software Rasterization on the CPU, I gave it a try in C++. Here are the results. The experiment includes depth testing, back-face culling, blending, MSAA, trilinear filtering, gamma correction and per-pixel lighting.
I am impressed that a CPU can draw 3206 triangles at 1280x720 with 4x MSAA at ~20FPS. I wouldn't try to build a game with this renderer, but it was a fun experiment.
216
Upvotes
4
u/yetmania Sep 09 '25
I think this tutorial is really good: https://www.scratchapixel.com/lessons/3d-basic-rendering/rasterization-practical-implementation/overview-rasterization-algorithm.html
I also learned some details by reading some chapters in the book "Real-Time Rendering" and by reading the Vulkan specifications. The Vulkan specs may seem long, but most of it are details about valid function usage that can be skipped.