To modify lab2 so it becomes recursive ray tracing with shadows.
Assignment
The left input file was wrong for the image. It's been corrected now. (10/25)
Modify your ray tracer to incorporate refraction, reflection, and shadows. Use at least 5 levels of recursion.
Shadows:
For each visible point, loop through the light sources. For each one in front of the visible point, form a ray from the point to the light source and see if it intersects any object. If it does, and the object is not transparent, ignore the effect of that light source on the point. If the object is transparent, attenuate the intensity of the light source.
Reflection:
Do reflection if the object is at all shiny (ks > 0.0). Recursively call for shading in the reflection ray direction. Add the color from the reflection to the surface color scaled by the shininess coefficient.
Refraction:
Use an index of refraction of 1.0 for air and choose another value for all other material.
Dr. Shen suggest 1.5. In my samples, I found that 1.05 worked well for the input files I was using (found in /usr/class/cse681/parent/data).
Negate the normal for exiting intersections of transparent objects. Linearly blend the color of the surface of the object with refracted light using the transparency coefficient.
Read in a scene description file just like Lab #2.
Each object command should now have parameters kt and n1 (Snell value) after the kd parameter, for example,
sphere 10.0 0.0 0.0 10.0 0.8 0.4 0.4 0.6 0.6 10 0.6 1.05
center radius color Kd Ks n Kt n1
Your ray tracer should include all the lighting components from lab2.
Call your program lab3.
As before, your program should take one argument, the name of the scene description file.
The grader should be able to do the following (if the output file specified in output.ppm) on a departmental machine under UNIX:
make
lab3 input.txt
convert output.ppm output.jpg
display output.jpg
Include with your submission a sample input.txt file which contains a description of a scene with:
a camera,
at least two lights, and
at least 5 spheres, two of which are reflective and one of which is refractive.
Notes
Submission of multiple input files may receive extra credit if they are particularly interesting scenes and/or effects