Update: July 2014

I finally decided to upgrade the Raytracer program by giving it a UI  and moving away from the configuration file architecture. I took the OpenGL display from the Building Editor project, and added an FLTK GUI next to it in order to fully control the raytracer’s scene input. The user can choose to create sphere, square, or cylinder nodes in the display, which can then be translated, rotated, scaled, and recolored. Additionally, the user has full control over the camera position and view direction, which can be modified either using the GUI inputs or the mouse. Finally, there are also controls for light positions and colors, and up to eight lights can be added to each scene. Once the user has set the scene to their liking, they click the “Raytrace” button and the image is generated. This drastically reduces the time needed to setup and render a specific scene, but uses the same effective raytracing algorithm that I started with.


Original Post:

Created a fully functional raytracer using C++ and OpenGL. The raytracer functions by reading in a configuration file which specifies a building scene created with the building editor. After creating the scene graph specific to the building layout, as well as retrieving values for light positions and object materials, a ray march is performed from each pixel location. As the ray is marched through coordinate space at a pre-determined step interval, when an object is encountered the Blinn-Phong lighting model is used to compute the color at that location. The Blinn-Phong lighting model calculates the sum of the diffuse, specular, and ambient light contributions at a particular point in the scene.

After the color for each pixel is returned, a BMP image is output as a result. The raytracer takes into account specular highlights, various materials, reflections, shadows, and multiple lights. It also runs efficiently by placing bounding spheres around all of the objects to quickly determine whether a ray intersects any geometry. Example images produced by running the ray tracer on a test scene and on a building layout can be seen below. Both scenes contain objects that are specular and reflective, as well as two lights. The second image contains both extrusion and surface revolution objects along with primitive shapes.