A Path Tracer

One bounce at a time, from a single ray to a million triangles.

San Miguel courtyard — afternoon sun through the tree canopy onto the stone floor and dining tables
FIVE CHAPTERS LATER  ·  SAN MIGUEL  ·  ~10M TRIANGLES  ·  CPU PATH TRACED

The path tracer starts as a question — what does this ray hit? — and ends as a courtyard rendered at ten million triangles, lit by an HDR sky and a hundred small lamps. Each chapter breaks an assumption the previous one was hiding behind.

Geometry comes first: rays, primitives, the bounding volume hierarchy that makes a hundred thousand intersections cheap. Then light, introduced stochastically — a pixel becomes the answer to an integral, solved by Monte Carlo with explicit connections to the sources. Surfaces stop being flat at the scale that matters; the BRDF grows three terms and a sampler that follows the lobe. Light is allowed to pass through a surface, refract, and emerge tinted by what it travelled through. The hand-placed sphere light is replaced by a sky and by every emissive triangle in the scene — and the scene itself becomes San Miguel.

The rendering equation does not change across the five. What grows around it is the renderer's grasp of the scene — surface by surface, light by light, scale by scale — and each widening unlocks an image the previous chapter could not produce.

CHAPTERS

  1. 01

    First Hit

    — Ray Casting

    Where a renderer is mostly a machine for finding numbers — and the gap between mathematically correct and computationally tractable becomes visible.

    Ray–primitive intersection BVH Möller–Trumbore GLM
  2. 02

    Light Finds Its Way

    — Path Tracing

    Where the renderer stops asking what each ray hits and starts asking what the light is doing after it gets there.

    Monte Carlo integration Cosine-weighted sampling Russian Roulette Next-event estimation
  3. 03

    Mirrors

    — Microfacet BRDFs

    Where surfaces stop being flat at the scale of light, and the BRDF starts negotiating between what diffuses and what reflects.

    Cook-Torrance Phong NDF Smith G Schlick Fresnel
  4. 04

    Through Glass

    — Transmission

    Where light is allowed to enter a surface, bend through it, and emerge tinted by what it travelled through.

    Snell refraction Microfacet BTDF Total Internal Reflection Beer's Law
  5. 05

    The Room Itself

    — Image-Based Lighting & Scale

    Where the renderer leaves the test scene behind and walks into a courtyard of ten million triangles, lit by a sky and the lamps in the room.

    HDR Environment Map Importance-sampled CDF Area Light from emissive geometry Binary scene cache