CIS 736 (Computer Graphics)
Spring, 2004
Homework Assignment 3 (Machine Problem)
Friday, 26 March 2004
Due: Friday,
23 April 2004 (by 5pm)
This programming assignment is intended to apply your
understanding of ray tracing to the implementation of a simple engine. This
homework may not be dropped.
Please
only make one program for the entire machine problem. Do not make
individual programs for each question. Instead, each of these steps are what we
are looking for you to implement out of each step in the overall ray tracing
algorithm. Refer to FVD Chapter 16, page 780 for the pseudo code to a recursive
ray tracer.
- (10 pts) Parsing
the input file. The input files for this assignment are much different
from the previous assignments. Your parser should support four major
functions: Camera, Sphere, Polygon Surface, and Light. Please refer to the
scene file as an example.
- (30 pts) Closest
object per pixel. Use the formulae on FVD pg. 702-703 to find if a ray
intersects a surface and if it is the closest object.
- (10 pts) Write to
a tiff file. It's hard to prove your program works without it. Most
linux distributions provide the library libtiff. Please refer to the
documentation at ww.libtiff.org for instructions on using the library. Pay
special attention to the functions TIFFOpen(), TIFFWriteScanline(), and
TIFFClose()
Extra Credit
- (15 pts) Surface
color. This is the first step in finding the final color of a surface.
For polygon surfaces, incorporate phong interpolation model. Use a phong
illumination model for all of the surfaces. The colors for each surface
are given in the scenefile. If the color is defined, every object created
after that definition will be that color, until a new color is defined.
The same applies for opacity, transparency, Ka, Kd, and Ks.
- (15 pts) Reflection
and Transparency. The last step in the ray tracing algorithm on page
780 is the recursive step for Reflection and Transparency. Implement this
recursive step and blend the results according the reflection and opacity
coefficients provided in the scene file.
Suggestions
Implement
the parts of the problem in this order:
- Parse the input file
- Closest object per
pixel.
- Write to a tiff file
At this point, just write a colored pixel if it intersects an object and a
black pixel if not.
- Surface color Make
sure the colors are written to the tiff file.
- Transparency