MATTHIEU DELAERE

GRAPHICS PROGRAMMER

email github twitter linkedIn
Software Rasterizer - C++ Graphics Programming Course

2019 - 2020 • Digital Arts and Entertainment Course

DESCRIPTION:

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:

  • solving the visibility problem using rasterization.
  • creating a depth buffer conform the DirectX implementation.
  • about correct depth attribute interpolation, emphasising potential problems of linear interpolation (e.g. normals).
  • loading simple models and textures.
  • about texture sampling and filtering.
  • performing simple pixel shading, using phong specular and normal mapping.

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.


CODE SNIPPETS:

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.