# CPSC310A Assignment 9 - Reflectivity

## Due Monday February 27

### Details

Modify your C++ ray tracing program to include the ability to render
objects with reflective surfaces. The color of a reflective surface
is computed by combining the color of the surface's material with the
color computed from a recursive ray trace originating at the
intersection location.

The amount of reflectivity of a surface is specified with the
K_{s} term that is also used for the specular reflectivity of
a material. Therefore, you do not have to modify your scene file
parsing code. You should modify your illumination calculation
function to compute a fourth term, reflective illumination with the
equation:

I_{r} = K_{s} * R(θ) * illum(ray(p, r))

Where I_{r} is reflective illumination, K_{s} is the
material's specular reflectivity, R(θ) is the approximation to
the Fresnel reflectivity of a surface, p is the intersection location,
r is the view reflection vector, and illum is the is the illumination
of the closest object in the scene that intersects with the view
reflection ray. The approximation to the Fresnel reflectivity is
calculated with the equation:

R(θ) = K_{s} + (1 - K_{s})(1 - cos θ)^{Ns}

Where K_{s} is the material's specular reflectivity and
θ is the angle between the view reflection vector and the
surface normal at the point of intersection. If the scene contains
more than one reflective object then the recursive illumination
calculation can be infinite. Prevent this by terminating the
recursion by returning the background color if the maximum recursive
depth is reached. The maximum recursive depth should be specified
with a constant variable.

### Submission

Tar your code in a file that contains your name and submit it on the course
Inquire site.