Raytracer
This project was to build a fairly extensive raytracer. In addition to
the raytracing algorithm (intersection with objects) the project handled a
number of more complicated concepts, including soft shadows, jittered
super-sampling, texture mapping, reflections, and transparency through thick
objects. All scenes are read in from a .ray file (see example at bottom), and
then parsed into a scene object which is then raytraced.
Implemented Features
- Intersection with triangles
- Intersection with spheres
- Specular and diffuse lighting from:
- Point lights
- Directional lights
- Spot lights
- Normal shadows for each light source
- Scene transformations
- Reflections
- Transparency
- Jittered super-sampling (anti-aliasing)
- Soft shadows
- Snell's law for refraction through think objects
- Texture mapping
Images
A number of the above features can be seen in this image - The scene is lit
by a number of different kinds of light sources which all cast soft shadows,
as can be easily seen on the floor in front of the pile of balls. Recursive
reflections can also be seen, the right had pile of balls is actually a
reflection (there is only one pile in the scene), and then that reflection is
then reflected again off the floor. The softness of the edge of the floor on
the right side is also due to the anti-aliasing that is taking place.
The most interesting thing about this image is the refracting image through
the front sphere. This refraction is done using Snell's law. Another
interesting thing is the internal reflection of the pile of balls in the front
sphere, this is there because the recursive limit of ray casting for
transparency and reflection is quite high.
This image doesn't really have anything new in terms of implementation details,
but is neat because of the way the spheres are deformed. This was because
the up vector for the camera was not perpendicular to the forward vector.
Movie
This is the movie that the second above
image was taken from - a clear sphere falling in front of a pile of balls.
Ray File
This ray file was used to produce the
first of the above images, and files of this form are all that are inputed to
the raytracer.