Ray Tracer

This project is largely inspired by the ray tracer used in the book Ray Tracing from the Ground Up, an excellent and highly recommended book on ray tracing by Kevin Suffern.

Setting the scene using OpenGL for positioning and sizing.

Camera modeling in the actual ray tracer.

Camera modeling in the actual ray tracer with supersampling (multiple rays per pixel and colors averaged).

This code adds the Phong illumination model to the raytracer. It does so by defining Diffuse and Specular BRDFs (Bidirection Reflectance Distribution Functions), as well as Matte and Glossy materials that utilize these BRDFs. Lighting was also defined with an Ambient and Point light.

The following adds a second light source to the above scene with an extra light to the left. This second light is only 40% intensity. Note that this model is still not quite ideal; there should never be a specular highlight within a shadow. In this rendering, the shadow edge from the larger sphere passes right over the specular highlight of the smaller sphere.

A procedural checkerboard texture function was added for the rectangular floor. The following rendering uses 2 lights, 16x anti-aliasing and a yellow-red checker pattern.

In addition to the standard checkerboard pattern, I added a fractal texture. The fractal computed is the Mandelbrot set, with a great deal of customization available including the offset, zoom, maximum iterations, fractal texture dimensions and outside, inside, and transitional colors. The following scene was rendered with two lights and 16x anti-aliasing.

Another scene with different fractal parameters.

This adds ray tracing with recursion, a perfect specular BRDF and a reflective material.