Path tracing is a Monte Carlo method for estimating camera-ray radiance by sampling light transport paths through a rendering scene. This page builds on the radiometric quantities and surface-scattering definitions from radiometry.
Path Notation
The notation is not a new kind of point. It is shorthand for asking about light traveling from the location toward the location .
Choosing a direction according to means that the renderer uses random numbers to produce a direction-valued random variable whose density is . In one dimension, a standard way to do this is the inversion method: start with a uniform random number and transform it so the output has the desired distribution. Direction sampling uses the same idea, but the output is a point on instead of a real number. By the definition of density, having density means that for any set of directions , the probability that the sampled direction lands in is .
Operationally, a renderer implements this with a sampling procedure: a function that takes one or more uniform random numbers and returns a direction. The function is designed so that the preimage of a direction patch occupies exactly worth of area in the uniform random-number domain. Larger-density direction patches are assigned larger regions of the input random-number square, so they occur more often. The path tracer later divides by , so sampling some directions more frequently changes how noisy the estimate is, not which radiance integral is being estimated.
- Find the next ray-scene intersection. If the ray escapes, add any visible environment emitted radiance scaled by , and stop.
- If the intersected surface emits light, add to , where is the emitted radiance at the intersection point in the outgoing direction back toward the previous path vertex.
- If direct light sampling is enabled, take a light sample and add its direct lighting estimator contribution scaled by to .
- If has reached the maximum path depth, stop.
- Take a BSDF sample to choose the next direction .
- Update
- Spawn the next ray in direction , set , and continue. At the next intersection, the new is the direction back toward the current point .