For a graphics course I took at Carnegie Mellon, I wrote a basic raytracer in C++. How it works is that rays are fired into a scene from a point on the light source. If the ray intersects with an object in the scene, a color value for the pixel at the location of the intersection will be calculated. Ambient, diffuse, reflection, and refraction components are used in this color calculation. The reflection and refraction components are obtained by recursively casting rays from the intersection point. If the ray fired from the light source does not hit an object, the ambient scene color is returned. Below are some screenshots which were rendered by my raytracer.