What Is Path Tracing?
Posted on Tue 27 October 2026 in tech
A path tracer follows light along random paths through a scene, bouncing off every surface it meets, and averages what the paths carry back to the eye.
What Is Ray Tracing? followed light off
mirrors and through glass and faked the rest with a constant ambientlight.
What Is Radiosity? computed the light passed
between matte walls, and only matte ones, because a patch stores one number. A
path tracer handles mirror, glass and matte alike, since each bounce draws its
next direction from whatever surface it lands on.
| Ray tracer | Path tracer |
|---|---|
![]() |
![]() |
The left render fills its shadows with a constant ambient light. On the right,
the path tracer fills them with light bounced off the walls, floor and table,
and it skips the scene's ambientlight and says so:
gmanpathtracer: ambientlight lights nothing under the path tracer; skipped 1 light(s).
Every path is sufficient, on average
Each random path is an honest estimate of a pixel, because its expected value is exactly the right answer. Alone it is noisy, and the average of many converges on the answer. Monte Carlo estimates a sum by averaging many samples of it.
The light reaching a point on the box's ceiling is the light arriving from every direction below it, each weighted by how squarely it strikes. A path tracer estimates it by looking in random directions. One look sees the red wall, the floor or the top of the shade, and it is right only on average. A hundred looks settle the estimate. The error falls as one over the square root of the count, so four times the looks halves it.
The looks have to be fair. A tracer that looks toward the bright floor more often counts each of those looks for less, in proportion to how much more often it chose that direction, so the average stays true.
The white room from the radiosity article puts numbers on it. Its walls reflect 80 percent, and its light is the sum
1 + 0.8 + 0.8² + 0.8³ + ⋯ = 5Monte Carlo finds the 5 without the formula. Send out a path. At each wall it survives with probability 0.8 and ends otherwise; count the walls it hits. One path hits 1 wall and ends, and another hits 9. A path reaches its k-th wall with probability 0.8k−1, so the average count over many paths is exactly the sum, 5.
The coin flip at each wall is Russian roulette, and it is how a path tracer ends paths without dropping light. A fixed cap drops terms, and stopping the white room after four bounces loses 0.8⁴, 41 percent of the light. The ray tracer caps its mirror and glass chains at four bounces, which few scenes reach. A path tracer follows every matte bounce, where a cap costs real light. Roulette keeps every term on average. A path survives with probability q and, when it survives, carries its light divided by q, so the expected light is unchanged. The path tracer plays roulette from a path's fourth vertex, with q the share of light the path still carries, capped at 0.95.
A path, one bounce at a time
A path starts at the eye, one ray through the pixel, as in the ray tracer. At each surface it hits, it does three things:
- It asks one light. A shadow ray toward one light, chosen in proportion to how much it contributes, adds that light's direct term. This is next-event estimation, the ray tracer's shadow ray cast at every bounce.
- It picks a direction at random. The surface's BSDF, the rule for how the material scatters light, draws the next direction. A matte surface scatters anywhere over the hemisphere, most often near the normal; a glossy one near the mirror direction; a mirror and glass exactly.
- It keeps what the surface keeps. The path's throughput shrinks by the surface's reflectance, and roulette decides whether it goes on.
The pixel's colour is the average of the light its paths carry back. A random bounce sometimes lands on a lamp the shadow ray could also have picked. Multiple importance sampling, from Veach's 1997 thesis, blends the two estimates, so a small bright lamp or a sharp glossy highlight converges without fireflies, the stray white pixels a lucky path leaves behind.
Lamps can be shapes. AreaLightSource "arealight" turns the Sphere or Disk
after it into a light, and a lamp with size casts a soft shadow.
samples/materials.rib
lights four materials with two lamps, a warm disk overhead and out of frame and
the small blue sphere at the left. An area light shines from its outward face
only.

From the left are gold shinymetal, glass, a mirror and a plastic torus.
The picture traces 256 paths a subpixel. The sample traces 64, about two
minutes on one core of an Apple M3 Max:
gman -r gmanpathtracer samples/materials.rib
Two answers to one equation
| Radiosity | Path tracer |
|---|---|
![]() |
![]() |
Both renders are the box from the radiosity article, and they agree on the light. The side of the left sphere facing the red wall measures (104, 50, 44) from the radiosity pass and (104, 49, 43) from the path tracer. The ceiling, lit by bounce alone, measures (98, 89, 74) against (99, 89, 74). They part in the shadow under the left sphere, (61, 48, 40) against (49, 36, 30). At 64 paths per subpixel the path tracer took four minutes on an Apple M3 Max and still shows grain; the radiosity pass took 17 seconds and shows none.
On the right the lamp hangs dark. Its bulb, shade and cord glow only by
ambientlights, and the path tracer skips all three, so the spotlight under the
shade lights the room from a lamp that looks switched off.
Grain is how Monte Carlo reports its error, and quadrupling the paths halves it. The radiosity pass trades grain for blur. Its error is the patch size, and only smaller patches shrink it. The path tracer draws its random numbers from a fixed seed, so a scene renders the same picture every time, grain included.
To render it, replace the two Option lines in
box.rib
with Option "pathtracer" "integer samples" [64], set the first Ka to 0 and
run gman -r gmanpathtracer box.rib.
Four ways to solve it
Radiosity and path tracing differ in two choices, where the light is stored and how the equation is solved. The other two combinations exist too:
| Deterministic | Random | |
|---|---|---|
| Patches | radiosity | stochastic radiosity |
| Points | ray tracing | path tracing |
Radiosity stores light on patches and solves exactly. Stochastic radiosity keeps the patches and shoots light at random. A Whitted ray tracer works at points and follows each ray exactly, along mirrors and glass only. A path tracer works at points and samples every bounce at random. All four answer L = Le + K*L, and production renderers mix them, caching the diffuse light a solver computes and path tracing the rest.
Try it
Install gman with the tarball's install.sh, as the
README shows. Then add one line
to samples/vase.rib in the unpacked folder, under PixelSamples 2 2:
Option "pathtracer" "integer samples" [64]
and render it through the path tracer:
gman -r gmanpathtracer samples/vase.rib
That writes the path-traced vase above, in about three minutes on one core of an Apple M3 Max, since the path tracer renders on one thread.
Links
- gman on GitHub, with its releases and changelog
- The gman page
- Physically Based Rendering, the reference for gman's path tracer
- Veach's thesis, where multiple importance sampling comes from



