Building a simple software rasterizer in Rust. Initially, the project mostly followed Coding Adventure: Software Rasterizer by Sebastian Lague with some adjustments to more closely follow modern graphics APIs. As the project grew I got interested in implementing more features such as lights, shadows and more advanced shading.
Performance for pure rasterization is pretty decent but shadows and lights really slow things down. The design of the rasterizer follows modern graphics APIs (OpenGL, DirectX, Vulkan) which is probably part of the problem why it is slow. These APIs target highly parallelized and optimized GPUs which can solve many of the problems encountered in rasterization much more efficiently than implementing those same algorithms on the CPU.
- Thomas Akenine-Möller, Eric Haines, and Naty Hoffman (2008) "Real-Time Rendering", 3rd Edition, A K Peters, Ltd (see https://www.realtimerendering.com/ for the current edition)
- Great explanation of orthographic and perspective projection
- All the math behind the OpenGL projection matrix
- Overview of rasterization algorithm
- Clipping in homogeneous space, Blinn and Newell (1978) - Clipping using homogeneous coordinates
- Perspective-correct interpolation - a crucial step for interpolating vertex shader outputs across fragments
- Explanation of shadow mapping
- Shadow Maps
- Additional lights and shadows: Point lights, Directional Light
- Rudimentary but interesting shader model, e.g. Blinn-Phong
- Normal mapping