Diffuse Interreflections

In addition to other distributed ray tracing effects, the most complex in scope implemented in this project is an **attempt** at diffuse interreflection. In the original implementation of the ray tracer, intersection with a specular object would result in the tracing of reflected ray. However, interaction with a diffuse surface would generate no such reflection.

Rather than adapt the general structure of the ray tracer to Monte Carlo path tracing, we used Monte Carlo methods to integrate the incoming light at a diffuse surface. When a ray strikes a diffuse surface, a parametrizable number of sample diffuse rays are distributed over the outward-facing hemisphere. The cosine-weighted samples are summed and normalized to find the illumination of the surface due to reflection.

In order to obtain an image with acceptable noise, many Monte Carlo diffuse reflection samples must be taken. However, this is extraordinarily computationally intensive. Therefore, our algorithm passes the maximum depth to the method calls of the ray tracer that compute the color of the sample rays generated from a diffuse surface. All rays start from the viewpoint; one top-level tracing call may interact with several specular or refractive surfaces (which spawn only one child ray), but tracing a ray starting from a diffuse surface will never result in more child rays. This keeps the complexity in line, and provides an effect similar to computing the first bounce — however, it is the first bounce off a diffuse surface when starting the ray from the camera position, not the light position.

The final image took 4 hours of single-threaded rendering time.

Computing lighting of dffuse surfaces samples 16 shadow rays and 16 reflection rays

Computing lighting of dffuse surfaces samples 16 shadow rays and 16 reflection rays

Here, the “egg” and front cube shadow parts of the floor and wall from the green wall’s color — bleeding to these areas would be seen with higher depth, but is computationally intensive.

Calculating lighting on diffuse surfaces samples 32 shadow and 32 reflection rays

Calculating lighting on diffuse surfaces samples 32 shadow and 32 reflection rays

128 shadow rays, 128 reflection rays

128 shadow rays, 128 reflection rays