Features


Reflections

Pic Specs: 100 spheres, 6 ray bounces, 2 lights, 1024x1024 image, ~10fps

Reflections were the first secondary ray implemented. The initial implementation simple grabbed a fraction of the color from the first object intersected with the reflected ray. This was made more correct after adding refractions, and finding the actual reflectance cooeficient with Fresnel's equations.


Refractions

Pic Specs: 100 spheres, 3 ray bounces, 2 lights, 1024x1024 image, ~30fps

Step 1 is to use Snell's law to find the direction of the refracted ray. You then need to travel through the medium (the sphere) and intersect with it from the inside. Using Snell's once again gives you the outgoing ray which can collide with the world and give you your refraction color. Fresnel's equation tells you how much color comes from reflections vs. refractions. Refractions caused me a good deal of trouble (wish I had error pics).


Depth of Field

Pic Specs: 50 spheres, 2 ray bounces, 2 lights, 512x512 image, ~5fps

This is an attempt to model how cameras have a certain focal length out of which things are blurred. To model this, for every ray cast from the eye, I actually cast several rays from slightly displaced points along the screen plane (read: REALLY EXPENSIVE). The amount of displacement alters how extreme the blurriness becomes as you move from the focal point. The most visible artifacts are the small dots visible along sharp edges of changing color, because depending on how the rays get cast, it pulls more of one color over the other. This diminishes as ray count increases. Implementing depth of field had it's own set of problems (with error pics this time! Check out the error page).