home/ atoms/ recursive-ray-bouncing-depth-limit

Diffuse path tracing recurses on random scatter directions until a depth limit terminates the chain

When a ray hits a diffuse (matte) surface, it scatters in a random direction in the hemisphere above the surface normal. The scattered ray is fired again and may hit another surface, recursing until either the depth limit is reached or the ray escapes to the sky. At the depth limit, zero light is returned (simulating light trapped in the scene). This recursive Monte Carlo process naturally produces soft shadows, color bleeding, and ambient occlusion — without any explicit shadow or ambient pass. The depth limit prevents infinite recursion when light bounces between parallel mirrors.

Examples

A ray hits a red diffuse sphere, scatters toward a white ceiling, scatters again toward the sky — the final sky color is multiplied back through the chain, tinting the floor red.

Assessment

Why does lowering the max bounce depth make scenes look too dark? What does a depth of 0 produce?

“let's limit the maximum recursion depth, returning no light contribution at the maximum depth.”