Rasterization Pipeline breaks the process of converting 3D triangles into 2D pixels into several highly-parallel stages, allowing for a variety of efficient hardware implementations. This assignment implements parts of a simplified rasterization pipeline in software without a GPU.

Rasterization Pipeline

  • starts with an array of Vertices
  • transforms these vertices via Program::shade_vertex to produce ShadedVertices
  • assembles these vertices into primitives of type primitive_type
  • clips the primitives (possibly producing more/fewer output primitives)
  • divides by w and scales to compute positions in the framebuffer:
  • rasterizes the primitives to produce Fragments
  • tests fragment depths vs depth buffer (based on flags)
  • transforms fragments via Program::shade_fragment() to produce a color and opacity, stored in a ShadedFragment
  • writes color and/or depth to framebuffer (based on flags)

Depth Testing and Blending

Depth always, from left to right, using blend replace, blend add and blend over.

Depth less, from left to right, using blend replace, blend add and blend over.

Mip-Mapping

Mip-mapping can be used for texture anti-aliasing. This is a tilted view to show the benefits of trilinear sampling.

Supersampling

This is rasterizing a triangle with only sampling from the center of the pixel.

This is rasterizing a triangle by sampling 64 equally spaced points in the pixel - note the smoothness in the edges compared to the center rasterized image.