Homework 9 - Mirror and Glass
For this project I have created two new material classes: Mirrors and Glass. For mirrors we just take the incoming ray and reflect it only in the direction exactly the same number of degrees off the normal but facing away from the surface. A value of .8,.8,.8 for the attenuation tends to make it look like real mirrors. The following is an image at 3600 samples per pixel of 5 mirror spheres surrounding a diffuse sphere all hovering over another mirror surface. Thus you can see the reflection of the huge light source in the ground mirror, and also the underneath side of the small spheres.

By a similar principle we can create a glass surface. Basically we first determine how likely the ray is to reflect, and then randomly select with that probability whether or not it will reflect off the glass or transmit through.
Reflection is handled just as in the mirror case, however for transmission we calculate the refraction based on the refractive index of the change in materials. Then, finally we create a new ray in the defracted direction.
Once inside the glass the steps are similar, but rays can have "total internal reflection". Also, if we want colored glass we attenuate the color.