Uncategorized

A Software Rasterizer in Rust

Posted on

Two things I wanted to learn recently: the Rust language, and low-level graphics programming techniques. I also wanted to gain some freedom from the Unity engine. I had previously gone through the excellent book Raytracing in One Weekend, and wanted more! Building a software renderer seemed like a good way to go. Check out the code on Github Project goals: Learn to implement basic versions of modern graphics staples behind rasterization pipelines. No existing libraries may be used for graphics. I write all the code that produces a buffer of [R,G,B] pixels, and that gets sent to the screen. Derive proofs of all theorems used I may be guided by derivations done by others as guides, but I want to have gone through, and grokked, all of the algebra. I’ve long felt that I lacked proper mathematical background, so this was a big one. As a test: a week after learning a new trick I would sit down and re-derive it on my own, on paper, from first principles Along the way I’ve used several key resources to piece things together: ScratchAPixel’s Rasterization tutorials Fabian Giesen’s series on rasterization Eric Lengyel’s Foundations of Game Engine Development N.J. Wildberger’s Linear Algebra course on youtube From those places in turn there are lots of juicy papers to find. I chose SDL2 as a means to show CPU-side pixel buffer on the screen, and to enable user input later. With that included in the project, I was ready to get going. Bresenham‘s line […]