CSE 681 Lab 1
CSE 681 Lab 1
Assigned: January 13 2012
Due: Feb 1st, 2012 11:59 PM
Lab overview: Write a basic ray tracer to render spheres from open Inventor input files with simple illumination.
Objective: Upon finishing this lab, you will learn how to set up a camera and construct render rays from the given viewing parameters; to organize a basic ray tracer that computes a color for every pixel in the image plane; to implement basic ray-object intersection with simple illumination calculation; to create C++ classes (or C structs) that will be used and extended in the remainder of this quarter; to output the ray tracing result to a file that can be viewed later.
Task:
Write a ray tracer that uses the scene objects (spheres only) and camera information in the input .iv file to generate images
Name your ray tracer program ‘rt’. The program usage should be:
rt <input.iv> <output.ppm> <xres> <yres>
where <input.iv> is an Open Inventor file that contains only spheres; <ouput.ppm> is an image file in ppm format; <xres> is the width and <yres> is the height (in pixels) of your output image.
- Ignore any objects that are not spheres in the scene file
- Use the camera defined in the Open Inventor scene file.
If camera is not defined, use the following default:
camera position = (0,0,1)
camera view up vector = (0,1,0)
camera looks at (0,0,0)
camera aspect ratio = 1.0
camera field of view angle = 45 degree
Information about how to retrieve the above information from an Open Inventor file and how to construct your eye coordinate system and rays can be found in the class lecture notes and the lab help page on our class web site.
- Objects need to be transformed to the correct positions based on the transformation stored in the Open Inventor scene file. Information about how to do this can be found in the lab help page
- Object colors are defined as the material properties of the Open Inventor scene file. Use diffuse color only. To give a better sense of depth for the rendered objects, use the following simple illumination model:
a. calculate the normal (nx,ny,nz) at the ray intersection point
b. normalize the normal, i.e., (nx,ny,nz) / |(nx,ny,nz)|
c. dot product the normalized normal with a vector (0,0,1)
d. If the value is less than zero, set it to zero
e. scale the object color by this illumination value
- Each component of the object color after illumination calculation should be clamped to [0,1]. Output the image to a ppm file. The ppm file format and how to create the file can be found in the lab help page.
Lab submission
- Submit your source code (.C and .h) and Makefile. Make sure your program can compile and run in our sun server stdsun.cse.ohio-state.edu even if you use PCs or Macs to develop your code.
- 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 nice scene files that you want the grader to use, you can submit them.
- Submit a readme file specifying what have been submitted and how to compile and link your program if special instructions are needed.
- Use the following command on stdsun to submit your lab1
submit cs681aa lab1 <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 lab1 lab1.c
> submit c681aa lab1 readme
will result in ONLY 'readme' remaining in the lab1 submission
You should do the following:
> submit c681aa lab1 lab1.c lab1.h .... readme
or
> submit c681aa lab1 lab1_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 lab1_dir
> submit 681aa lab1 .
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/13/2012 Han-Wei Shen