Assignment 2 - Path Tracer (William Li)

I built this raytracer from scratch and implemented the following features:

Surfaces
Supports diffuse (lambertian), glossy (phong brdf), and reflective materials
Area Lights/Soft Shadows
I implemented area lights using a series of jittered points. I sampled the area light when tracing rays through the scene and multiplied by the area for weighting. This automatically gives soft shadows since I sample from a random point on the area light for direct lighting too.
Separation of direct and indirect light
Useful to see what contributions are coming from which type of light.
Russian Roulette
I implemented russian roulette path termination, with the weights being set by the diffuse, specular, or reflective color components, based on what type of surface it is.
Uniform and importance sampling
Uniform sampling works well, but importance sampling either has a bug, or doesn't significantly increase the quality of the image because of all the noise inherent in my path tracer.
Ray inspector
A useful tool when debugging, but also if you're just curious where the contributions from each ray came from. It'll show all intersections, emissions, reflections, and termination type in the scene for a given pixel.
Subpixel sampling
Each pixel is sampled in random locations for antialiasing purposes.

Diffuse Cornell Box

Direct Lighting Only (100 rays per pixel)

Indirect Lighting Only (10 rays per pixel)

Note - there is a shadow above the area light because it is actually floating a bit off of the ceiling.

Direct + Indirect Lighting (100 rays per pixel)

Note - there is a shadow above the area light because it is actually floating a bit off of the ceiling.

Reflective + Glossy Cornell Box

Direct Lighting Only (10 rays per pixel)

Indirect Lighting Only (10 rays per pixel)

Direct + Indirect Lighting (10 rays per pixel)

Source

Download binary and source (requires Visual Studio 2010 with the XNA Framework). You will need the XNA 4.0 installer to run both the binary and source

Extra

Debugging Utils

Like I mentioned above, the debugger will show the current pixel X and Y location, in addition to the color of the pixel, and all the steps that were required to get to that color.

Swirlies!

While trying to make each pixel deterministic for the debugger, I picked a bad seed for each individual pixel (x*y*600), which led to an interesting pattern.