A software rasterizer written from scratch in Rust, built as a learning project for the language.
No GPU, no unsafe shortcuts — triangles are rasterized on the CPU using barycentric coordinates, with a z-buffer for depth and texture mapping from .obj/.tga model data.
- OBJ model loading (positions, UVs)
- Look-at camera + perspective projection
- Triangle rasterization via barycentric coordinates
- Z-buffering for depth/occlusion
- TGA texture mapping
- Backface culling
Each vertex is transformed from model space through a model-view matrix, a perspective projection matrix, and finally a viewport matrix to reach screen space. Each triangle is then rasterized by computing barycentric coordinates for every pixel in its bounding box; pixels outside the triangle are skipped, and a per-pixel depth test against the z-buffer resolves occlusion. A fragment stage samples the diffuse texture using UVs interpolated from the triangle's vertices.
Loosely inspired by tinyrenderer.
cd renderer
cargo build
cargo run
Lighting, anti-aliasing, shadows, multithreading — single-threaded CPU rasterization only, for now.
