CS 4451 Computer Graphics

Assignment #2: a scan-line renderer

Due: March 1, 2002 at 11:59 PM

Problem Statement

The purpose of this assignment is to write a scan-line polygon renderer that uses the z-buffer algorithm for hidden surface computations. The z-buffer algorithm is described in FVFH, Chapter 15.4 (pp. 668-672). You can find a description of the scan-line rendering algorithm in FVFH, Chapter 15.6 (pp. 680-685).

The polygonal model of the house and most of the code are made available to you in the startup code with the appropriate comments detailing the data structures in use and the code flow. You need only fill in sections of code marked /* CODE: .... */ in the function scanConvert in the file p2.c. You will only submit p2.c and I will compile and run it with the original .c and .h files. Therefore, I suggest that you do not modify any of the files that you download other than p2.c.

Startup Code and Sample Output

The startup code does not implement polygon clipping and shading. A sample output for 3 test cases that do not require clipping (view1, view 4, and view5) is provided in the *.ppm format in files view1.ppm, view4.ppm, and view5.ppm. On SGI's you can view *.ppm files with xv (e.g., xv view1.ppm). The result of the scan conversion is saved into a file result.ppm. Also, the house is rendered from the view supplied using OpenGL (with clipping).

NOTE: When you run the program an image appears in an openGL window. This is an openGL implementation of clipping, z-buffering, and rendering (not your implementation). Your scan-line rendering and z-buffer code outputs an image to result.ppm. To debug your code, run:

% p2 < ../viewX

open the file, "result.ppm" with:

% xv result.ppm

and compare it to viewX.ppm.

Grading Criteria

-05 points:  no acceptable README file
-05 points: viewport not 500x500
+40 points: the program compiles and runs without a coredump.
+60 points: I will use several test cases to judge your z-buffer and scan-line rendering code. (If it works for view1, view4, and view5, it will work for my test cases.)

Extra Credit

+20 points: implement Gouraud Shading. See FVFH, Chapter 16.2.4 (pp. 736 - 737) for details.
+30 points: implement Phong Shading. See FVFH, Chapter 16.2.5 (pp. 738 - 739) for details.
+50 points: implement polygon clipping.
 

Notes

Submission Rules