2019 - 2020 • Digital Arts and Entertainment Course
As part of the new Graphics Programming course, students have to write their own software rasterizer. Later in the semester they have to write a small DirectX 11 framework. In the end they have to be able to toggle between both the software and hardware rasterizer at runtime with minimal visual differences (due to DirectX optimizations). Students write their own rasterizer to learn:
On this page you can find one simple implementation of a software rasterizer, supporting the features mentioned above. This was used during the lectures as a reference. Just as with the ray traycer assingment, students only get a few files that help them with window handeling and mathematics.
Below are code snippets of some of the most interesting parts of software rasterizer. Feel free to analyze the entire github repository as well!
Vertex Transformation: transforms every vertex into clipping space (NDC), before the culling stage. It performs the typical vertex shader actions as well as parts of the rasterization stage (perspective divide, io).
Attribute Interpolation: performing correct depth attribute interpolation using barycentric coordinates. Also stores the correct data in the depth buffer.
Pixel Shading: example of software pixel shader using lambert diffuse, phong specular and normal mapping.