CIS 736 (Computer Graphics)

Spring, 2002

Machine Problem 4

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.

 

  1. (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.

 

  1. (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.

 

  1. (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

  1. (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.

 

  1. (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:

  1. Parse the input file
  2. Closest object per pixel.
  3. Write to a tiff file At this point, just write a colored pixel if it intersects an object and a black pixel if not.
  4. Surface color Make sure the colors are written to the tiff file.
  5. Transparency