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


image-02.png: Lengthened ellipsoid

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


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


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


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


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


image-07.png: Compute reflections

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


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


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


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


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


There are three point lights:

image-12.png: Putting it all together

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


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.