CS488 - Extended Ray Tracer

Extra Primitives

Sphere, cube, cone and cylinder.
Torus and plane.

A4 Objective: Supersampling

For A4, I implemented supersampling. This is too slow for the number of pictures I needed to render, so I added adaptive supersampling.
A museum scene.
The scene using supersampling.
The scene using adaptive supersampling. Only 31975 / 250000 pixels (13%) were rerendered.
Showing the pixels that adaptive supersampling rerenders using supersampling.

Constructive Solid Geometry

Two spheres on the left, sphere and torus on the right. Cube and torus in the background.
Cone and cylinder on the left. Cube and sphere on the middle right. Two meshes on the right.

Photon Mapping

50,000 photons scattered around the scene.
50,000 photons scattered around the scene, estimating using the 200 photons closest to each ray intersection.
50,000 photons scattered around the scene, estimating using 200 photons. Using cone filter.
500,000 photons scattered around the scene, estimating using 2,000 photons. Using cone filter.

Area Lights

Sphere lights. Plane lights were also implemented (see the Photon Mapping section).

Tone Mapping

A Cornell box with tone mapping turned off. Notice how some areas are very bright, while other areas are still dark. Adding light to make the dark areas brighter will make the bright areas bigger.
A Cornell box with tone mapping turned on. The bright areas are darker, and the dark areas are a little brighter. The scene can now be made brighter.

Multithreading

Sample refers to the museum scene, with adaptive supersampling. This scene can be seen in the "Supersampling" section. This scene uses Phong lighting.
This has an almost linear speedup up to 32 threads. The machine these benchmarks were run on has 64 cores, possibly explaining why there is a regression around that point.
This scene can be seen in the "Photon Mapping" section.
The speedup appears to be logarithmic. Sorting photons and creating photon maps is not multithreaded, which might explain the limited growth.

Reflection

My puppet, Alakazam, in a box with mirrors as walls.
There are 4 balls and 2 mirrors in this image.
Reflection from a ring creating a caustic.

Fresnel Effect

A floor without the Fresnel effect. Notice how the brighter parts of the room are visible in the floor, but the darker part, near the floor, is not. Note that this scene has tone mapping turned off, so the bright area is very bright.
A floor with the Fresnel effect. Notice how the wall is clearly reflected in the floor farther away, but fades away closer to the camera.

Texture Mapping

All primitives can be texture mapped. For meshes, UV coordinates are read from .obj files.
Primitives can be alpha-mapped (top left and bottom) and specularly mapped (top right).

Phong Shading

Without Phong shading on the left, with Phong shading on the right.
Without Phong shading on the left, with Phong shading on the right.

Refraction

Three spheres in a Cornell box. The left sphere has an index of refraction of 6, while the right has an index of refraction of 2. The middle sphere is reflective.
A pencil in water, creating a refraction effect.

Final Scene

One Last Thing

Light being refracted in a prism, creating a rainbow. This was generated from mixing many images, each using a different wavelength of light and index of refraction.

Thank You

Most of my program is based on algorithms discovered by various researchers, including Jensen and Phong. I stand on the shoulders of giants.

Thank you to Stephen Mann for lecturing and to the TAs this term for their support.

Thanks to Mark Keller who made suggestions to improve my scenes.

Models and Textures

I used Suzanne, embedded in Blender; a sphere and a cow mesh, which were included in the sample code; and the Utah Teapot, acquired from the University of Utah website. All other models were created by myself, either using CSG or in Blender.

I used an Earth texture from Planet Pixel Emporium, a wood floor texture from Free PBR, and a picture of Stephen Mann from a University of Waterloo website. I also used a colour grid texture that was embedded in Blender. Other textures were created by myself in Blender and GIMP, or a picture taken by myself.