Assignment 2: Raytracer

Created by Jeffrey Dong and Roger Chen.

Click on the pictures for a larger image.

image-01.png: Simple ellipsoid (sphere)

./raytracer images/image-01.txt images/image-01.png

448ms

image-02.png: Lengthened ellipsoid

./raytracer images/image-02.txt images/image-02.png

616ms

This was achieved using the Sphere primitive and a xfs (scaling) transformation.

image-03.png: Arbitrarily oriented ellipsoid

./raytracer images/image-03.txt images/image-03.png

541ms

This was achieved using the Sphere primitive, an xfs (scaling) transformation, and a xfr (rotation) transformation, and a xft (translation) transformation.

image-04.png: Render polygons (from .obj file)

./raytracer images/image-04.txt images/image-04.png

2300ms

The normals are inferred from the cross product AB x AC

image-05.png: Use simple Phong Shading (with color)

./raytracer images/image-05.txt images/image-05.png

2428ms

Vertex normals are provided in the .obj files. The phong shader interpolates normals at each intersection point. The shading itself is performed with a combination of ambient, diffuse, and specular terms.

image-06.png: Compute shadows

./raytracer images/image-06.txt images/image-06.png

2881ms

image-07.png: Compute reflections

./raytracer images/image-07.txt images/image-07.png

5313ms

Our max reflection recursion depth was set to 4.

image-08.png: Apply linear transformations to objects

./raytracer images/image-08.txt images/image-08.png

2705ms

We applied a rotation, a scale, an inverse rotation. Then, we applied a translation, a rotation, and an inverse translation.

image-09.png: Use point lights

./raytracer images/image-09.txt images/image-09.png

3778ms

There are two point lights (left and right). The bottom sphere is closer to the camera, which is why it appears bigger and is shaded slightly differently.

image-10.png: Use directional lights

./raytracer images/image-10.txt images/image-10.png

2841ms

There is one directional light coming from the bottom (pink) and one directional light coming from the upper left (yellow).

image-11.png: Use point lights falloff feature

./raytracer images/image-11.txt images/image-11.png

4923ms

There are three point lights:

image-12.png: Putting it all together

./raytracer images/image-12.txt images/image-12.png

21155ms

There are two mirrors, one in front and one behind the camera. There are 8 spheres in front of the camera, which are reflected back and forth by the mirrors, to a maximum reflection depth of 4.