Ray Tracer
This is a small project whose primary purpose was to understand the inner workings of a ray tracer. However, it can also be useful for quick and dirty renderings. The code can be found here. It provides a Geometry class which can be used to add new shapes. The only function which has to be implemented while adding a shape is
virtual int intersectRay(Ray& ray, Vector3d& interPoint, Vector3d& interNormal) = 0;
	  
This function takes a ray as input and returns 0 if there was no intersection, 1 if there was an intersection from the outside and -1 if there was an intersection from the inside. In case of an intersection, the function sets the intersection point and normal direction. It is fairly easy to implement this function for a triangle mesh for example. Similarly, it's possible to add different lights and shaders. The program loads a scene through a lua script such as this one. For each object the user can determine the color, reflectiveness, shininess, amount of diffuse lighting, index of refraction and other object specific parameters. The position and properties of the lights are also contained in the file.
For example, here is the output for three very reflective balls:
This is the outcome of experimentation with the index of refraction: