CIS 736 (Computer Graphics)

Spring, 2001

Machine Problem 6

Catching some rays

Due:

This machine problem will teach you more about raytracing than you care to know.

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 raytracing algorithm. Refer to FVD Chapter 16, page 780 for the psuedo code to a recursive ray tracer.

Raytracing is about as painfully slow as possible. Please run your programs on Topeka and Salina for best performance. Avoid linking against OpenGL if possible, you shouldn't need it. We won't hold it against you (or reduce your grade)if you must, however.

  1. (5 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 first scenefile as an example. A more complex file will be provided next week. The definitions for these basic primitives will follow the equivalent fuctions from the Renderman Spec.
  2. (20 pts) Closest object per pixel. Use the formulas on FVD pg. 702-703 to find if a ray intersects a surface and if it is the closest object.
  3. (10 pts) Surface color. This is the first step in finding the final color of a surface. For polygon surfaces, incorporate your phong interpolation model from MP3. Use a phong illumination model for all of the surfaces. The colors for each surface are given in the scenefile. If the a 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.
  4. (10 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 the reflection and opacity coefficients provided in the scenefile.
  5. (5 pts) Write to a tiff file. It's hard to prove your program works without it. Most linux distributioins profide the library libtiff. They are installed on topeka and salina. Please refer to the documentation at www.libtiff.org for instructions on using the library. Pay special attention to the functions TIFFOpen(), TIFFWriteScanline(), and TIFFClose().

Extra Credit: Are you crazy?

  1. (10 pts) implement accurate refraction on the transparency calculation
  2. (10 pts) extend the scenefiles to define other illumination models that you implement in your surface shading. (metal, lambertian, etc)
  3. (10 pts) implement a bounding box quick rejection for ray/object intersection

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 white pixel if it intersects an object and a black pixel if not. This is the minimum you can hand in, but that is also 30 of the possible 50 points.
  4. Surface Color
    If you finished MP3, this should not take you long. Make sure these colors are written out to the tiff file.
  5. Reflection and Transparency.