CPSC310A Assignment 17 - Indirect Light

Due Monday April 9

Details

Modify your C++ ray tracing program to render scenes with indirect lighting. Indirect lighting can be computed by using multiple random recursive rays to sample reflected light from surrounding geometry.

The illumination calculation function should be modified to not only generate random rays that hit lights in the scene, but also completely random rays. The emission of each of the random rays is calculated by recursively ray tracing with a ray with an origin at the intersection location and direction equivalent to the random ray. The illumination of the recursive ray should be used in the normal illumination calculations in place of a light's emissive color. The illumination of all of the random rays and all of the light rays should be averaged to compute the total illumination of an intersection point.

In order to generate random rays, add a method to the sample class that when given a surface normal returns the next random vector in the same hemisphere as the normal. Generate the random vector by using two random numbers to specify the latitude and longitude of a vector in the northern hemisphere and rotate the vector to the surface normal's hemisphere.

Submission

Tar your code in a file that contains your name and submit it on the course Inquire site.