The user starts by running the program with the input scene file, assuming that the project has already been built (see README in project). Initial variables are initialized to hold the current values from the parsed file. The input scene file is parsed line by line, and all parameters grabbed by the first argument, while the following arguments are converted properly into a float or integer, depending on the first parameter.
After the file is parsed, the Scene class and Ray Tracer classes are constructed, and RayTracer::raytrace is ran; this function is the main part of the code. Pixel by pixel, we cast a ray from the camera to the world depicted by the scene. If objects are hit, the object's material, global ambience, and lighting are contributed to the final color of the pixel. If otherwise the ray does not intersect, the final color would be the sky, which in our ray tracer, is black.
src: The source code for the Whitted Ray tracer implementation
accelerator: Implementation of BVH
core: Camera, Ray, Scene logic
geometry: Triangle, Sphere geometry, intersection logic
integrator: Ray Tracer logic
lights: Directional, Point light implementations
materials: abstract + phong shading implementation
main.cpp: parsing scene, running ray tracer, saving image
testscenes: Where all example scenes from class are put
third_party: used to contain external libraries and code to support saving images
Our biggest challenge during implementing the ray tracer was identifying the differences between our render of the image, and the correct image given by the test case. In particular, we found that our render had shadows that behaved very weridly, especially when testing scene 6. This was shadow acne, but we believed that shadow acne was often caused by missing epsilon shifts in the ray's position. In the end, we found that we forgot to reverse the normal calculation of the surface if the dot product between the ray's direction and the surface normal was positive. This is needed in order for the ray to hit the right surface. we do not want a ray intended to hit a front face to a hit a back face instead; otherwise it would cause lighting miscalculations.
Scene 1
Scene 2
Scene 3
Scene 4: Ambient
Scene 4: Diffuse
Scene 4: Emission
Scene 4: Specular
Scene 5
Scene 6
Scene 7