This page describes the Monte Carlo global illumination rendering system I built for assignment 1 in CS294-13 (Advanced Rendering Techniques). This rendering system produces global illumination effects by tracing multiple rays into the scene for each pixel. The rays are averaged according to the probability of following their respective paths. The secondary paths are chosen randomly from within the hemisphere about the surface normal.
* Multiple primary rays per pixel
* Secondary rays to sample light sources and indirect lighting
* Russian-Roulette termination
* Diffuse surfaces
* Specular surfaces
* Mirror surfaces
* Area light sources and soft shadows
* Basic Importance Sampling
I started this project using the raytracer I wrote for a previous graphics course. The above image is a simple scene rendered using this code. In this scene, I've rendered a semi-enclosed box with two spheres inside the box. The scene is illuminated by a single point-source above the objects. Note the simple diffuse shading model of the spheres and the hard shadows cast onto the box surface. Although these effects are geometrically correct, there is no global illumination and the scene lacks realism.
Here is the same scene now rendered using my Monte Carlo global illumination code. Each pixel represents the average of 1000 rays traced into the scene and randomly bounced around. The scene is illuminated by a large area light above and in front of the scene. Note the soft shadows and the color-bleeding from the spheres to the surface of the box.
Here is the same scene as above but with anti-aliasing turned on (1000 rays per pixel). I implemented anti-aliasing by jittering the location of each primary ray within the pixel boundaries. Note the smoother edges at the occluding contours of the spheres and the top-edge of the box (compare to the prior image).
I implemented mirrored surfaces by building in a special material case. For normal diffuse surfaces, I trace secondary rays in random directions within the hemisphere of the surface normals. If an object is set to have mirror-reflectance, then secondary rays are only traced along the reflected light direction. In the above image, I've inserted a mirror ball into the original scene. The image is rendered using 1000 rays per pixel.
This example image demonstrates several of the different material types my renderer supports.. From left to right, the spheres are rendered to be high-gloss, diffuse, mirrored, and semi-gloss. I rendered the diffuse surfaces by sampling the secondary rays according to the cosine of the angle the ray makes with the surface normal. The glossy materials were rendered by sampling with respect to the angle between the secondary ray and the ideal mirror direction. The mirror surface is explained in the previous example. This image was rendered with 1000 rays per pixel.
I also attempted to recreate the Cornell Box using my Monte Carlo Renderer. I placed one mirrored sphere and two diffuse spheres within the box. Although I my result demonstrates the typical global illumination effects such as soft shadows (especially on the walls of the box), I think my version of the Cornell Box is very dark. Making the area light larger at the top of the box helped, but I still had trouble improving the overall illumination level. Rendered using 1000 rays per pixel.
In this version of the Cornell Box, I tried adding a spherical light source within the box. This helped to brighten the inside of the box slightly. Note the soft shadow cast by the red sphere onto the left side of the box.
In this version of the Cornell Box, I sampled the direct lighting and indirect lighting separately. This has the effect of making the illumination slightly brighter. In this scene, I rendered the spheres to demonstrate some different material reflectance properties (mirror reflectance, glossiness). Unfortunately I think I introduced a bug: note the banding artifact on the sides near the rear of the box.
In this image, I've rendered several spheres on a slighly glossy "table top" which is illuminated by a large area light above. I rendered the image using 1000 rays per pixel.