Ray tracing: fire rays at random and add up where they land

How Monte Carlo ray tracing works Four panels. One: the selected light pattern, how the hot cell emits. Two: the model fires rays in random directions, more of them where the light is brighter. Three: each ray is followed in a straight line through the mesh, one ray at a time, and cells are tinted by how many rays cross them. Four: the radiation field is the sum of where the rays' energy lands: grainy with few rays, smooth and exact with many. A mesh selector shows that a finer mesh shares the same rays among more cells and so looks noisier. The true field is a dashed outline. 1. Selected light pattern how the hot cell emits brightness by direction dashed = reality, as in (4) 2. Model's random rays random, more where brighter 64 random rays 3. Solving in every cell cells count the rays that cross amber = rays tallied there 4. The result add up where they land dashed = reality · 32×32 cells
Try a different light pattern
How fine a mesh?
64
Fig. 6 — Monte Carlo ray tracing, step by step. Rays are fired from the hot spot in random directions — more of them where the light is brighter (2) — and each one is followed in a straight line through the mesh (3). The field (4) is simply where their energy lands, with reality as a dashed outline. Nothing is approximated about the directions, so a sharp beam stays a sharp beam; the only error is graininess, and it fades as you add rays: four times the rays, half the noise. The mesh is only where the energy is counted, so it never bends a ray — but it does set the noise: what matters is rays per cell, and a finer mesh shares the same rays among more cells. Every ray is independent of every other, which is why this scales so well on GPUs. A bounce off a wall is the same recipe again, starting from where the ray hit.
Why does a finer mesh look noisier?

In ray tracing the mesh does nothing to the rays. They cross cells in straight lines at any angle, and the cells only add up the energy that passes through them. So the mesh never constrains directions — a beam is always a beam — but it does decide how the counting noise looks. The error in a cell falls as 1/√(rays through that cell). Go from 32 × 32 to 64 × 64 with the same rays and each cell collects a quarter as many: the noise doubles, and with few rays most cells stay empty.

That is the cost rule of the method: to keep the noise fixed you need a fixed number of rays per cell, so four times the cells means four times the rays. Compare with discrete ordinates, where a finer mesh exposes the ray effect, and with PN, where the mesh changes nothing about the smoothing. Here the mesh is honest but hungry.