CPSC310A Assignment 10 - Transparency

Due Monday February 27

Details

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

The illumination calculation function should be modified to compute a fifth term, transmissive illumination with the equation:

It = (1- Ks) * (1 - R(θ)) * Tf * illum(ray(p, t))

Where It is transmissive illumination, Ks is the material's specular reflectivity, R(θ) is the approximation to the Fresnel reflectivity of a surface, θ is the angle between the suface normal (toward the ray origin) and the view vector, Tf is the transmission filter, p is the intersection location, t is the view transmission vector, and illum is the is the illumination of the closest object in the scene that intersects with the view transmission ray. If the transmission vector does not exist, because of total internal reflection, R(θ) should be set to white. If the transmission vector is exiting the object, the transmission filter should be set to white.

The transmission filter of a material is specified in an mtl file with a line that begins with "Tf" and looks like:

Tf r g b

Where r, g, and b are the amount that the red, green and blue light are filtered when passing through the object. If the transmission filter for a material is not specified, it should default to black.

In order to calculate the transmission vector, the optical density of a material is needed. The optical density of a material is specified in an mtl file with a line that begins with "Ni" and looks like:

Ni d

Where d is the optical density. Materials with density greater than air have a density greater than 1. Glass, for example has an optical density of approximately 1.5. If the optical density of a material is not specified it should default to 1.

Submission

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