CSE 681 Lab2
CSE 681 Lab2
Assigned: January 30, 2012
Due: February 15, 2012 11:59 PM
Lab overview: Enhance your ray tracer from Lab1 to include Phong illumination, shadows, and reflections (refraction will be in the next lab)
Objective: Upon finishing this lab, you will learn how to write a recursive ray tracer that includes global illumination effects such as shadows and reflections.
Tasks:
1. Remove the simple illumination model used in lab1 and replace it with the Phong illumination model.
1.1. Assume the color of the light is white, i.e., (1,1,1)
1.2. Ambient: Use 0.2 as the ambient reflection coefficient (Ka). Multiple this to the ambient color of the object
1.3. Diffuse: Scale the object’s diffuse color by N.L, where N is the object normal and L is the light vector
1.4. Specular: Set the shininess to 50 as the specular exponent of the cosine between V and R, where V is the
vector from the point to the camera, and R is the refective ray vector. Use the specular color of the
object as the specular reflection coefficient (Ks)
2. Add shadows to your ray tracer. For each visible point, loop through the light sources. If the point is facing to the light source (dot product of normal and vector to the light is positive), cast a shadow ray and test for shadow.
3. Add reflection: include reflection rays in your ray tracer.
4. Set your recursion level to 3.
6. Change your ray tracer command line to
rt <input.iv> <output.ppm> <xres> <yres> <shadow_on> <reflection_on>
where <shawdow_on> and <reflection_on> are 1 or 0 to turn the individual effect on or off.
Lab submission
If you developed your lab using stdsun, submit your source code (.C and .h) and Makefile.
If you developed your lab using Visual studio, submit your source code (.cpp and .h) and your VC project file
If you developed your using Mac, since it is very similar to using studio, please compile your program under stdsun and submit your files as in studsun above
Do not submit any executable files. Our grader will use the sample .iv files in the Data director of the sample_read_iv folder to test your program. If you have some nicer scene files that you want the grader to use, you can submit them too.
Submit a readme file specifying what are being submitted and how to compile and link your program.
Use the following command on stdsun to submit your lab2
> submit c681aa lab2 <names of all your files>
Notes about the submit program
The 'submit' program submits all of the files at once, not one at a time, previous submissions for a given lab are completely removed. Or put another way; each time the submit command is issued for a given lab, ALL of the previously submitted files are clobbered.
That means that
> submit c681aa lab2 lab2.c
> submit c681aa lab2 readme
will result in ONLY 'readme' remaining in the lab2 submission
You should do the following:
> submit c681aa lab2 lab2.c lab2.h .... readme
or
> submit c681aa lab2 lab2_dir
Where 'lab1_dir' is a directory containing all of the lab1 files to be submitted, or best of all (for both student and grader) is:
> cd lab2_dir
> submit c681aa lab2 .
Submit will immediately print submission information to the submitter. Use 'man submit' if you have any other questions.
Late Penalty
You should submit your lab on time. We are on a quarter schedule, which is pretty tight. Being late for one lab could affect the time left for you to complete subsequent labs. All labs are due at 11:59pm of the specified due data, and there is a 10% penalty each day for up to 50%. After that, you get zero.
Grading Criteria
Grading of the labs will be based on the following:
• 90%: Correctness and adherence to assignment specification.
• 10%: Readability, structure of code, use of comments, adherence to lab procedures (submitting, naming conventions, etc.)
The grader will grade the labs. If you have problems with the grade you received on your lab, see the grader first. If you can't resolve the dispute with the grader, then see me. However, in order to maintain consistent grading for everyone in the class, I am not very inclined to alter grades that are assigned by the grader.
Don't copy labs. Discussion of lab assignments is allowed and encouraged. However, you need to complete the lab all by yourself. Labs which are too similar will be handed over to the Committee on Academic Misconduct and handled by them.
Last updated: 1/30/2012 Han-Wei Shen