Rasterization and ray tracing are inverse nested loops: triangles→pixels versus pixels→triangles
Rasterization and ray tracing produce the same kind of image but with opposite loop orderings. Rasterization iterates ‘for each primitive, find which pixels it covers’ — projecting triangles onto the screen and using a z-buffer to resolve depth. Ray tracing iterates ‘for each pixel sample, find which primitives it hits’ — casting rays from the camera and finding the nearest intersection. This inversion is not merely academic: it changes which operations are cheap and which are expensive. Rasterization excels at primary visibility (what is visible from the camera) and exploits massive parallel hardware designed for triangle projection. Ray tracing excels at secondary effects (shadows, reflections, global illumination) because each ray independently traverses the scene. Modern GPUs combine both: rasterization handles primary visibility while ray tracing handles secondary effects.
Examples
A game renders geometry with rasterization (fast, triangle-optimised hardware), then fires shadow rays and reflection rays using GPU ray tracing for high-quality shadows and reflections.
Assessment
Describe the loop ordering of rasterization versus ray tracing. Given that a game only has ~1-2 rays per pixel for ray tracing, explain why it makes sense to keep rasterization for primary visibility.