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
-
Once you have the scan-line renderer and z-buffering working, you may wish to create
additional .c and .h files to aid in the development of the extra credit options. In this
case, submit all your code, README, and Makefile.
-
For shading you are to use normals of the faces -- you do not have to calculate
normals at the vertices.
-
You have to add light sources in order to showcase the shading capabilities
of your renderer.
-
If you do implement any of the extra credit, please supply a README file
that would tell me how to run your program to take advantage of the extra
credit features implemented, i.e. parameters that I have to supply to the
program, pop-up menu items, etc.
Submission Rules
-
The program must be written in C or C++ and compile and run using OpenGL
on an SGI Indy workstation in the CoC SGI lab. YOU must write the code
that implements the scan-line renderer and z-buffer (and the shading, if you want extra
credit).
-
You MUST include a README file that details both how well your program
works, quirks it might have, and a statement that you are trying for
the extra credit (if you are doing so.) Also, you must tell me how
to run your program. Finally, let me know if you are using
a late token.
-
Ensure your name and login name appear in each file you submit.
-
Put p2.c and README (and the Makefile, .c and .h files you create if you are attempting extra
credit) in a directory on a CoC UNIX machine. Name your directory last_first_2 where
last is your LAST NAME and first is your FIRST NAME (The "_2" corresponds to the assignment
number). Then, from the parent directory, execute the following command:
% tar -cvf last_first_2.tar last_first_2
For example:
I would create a directory Parry_Mitch_2,
% mkdir Parry_Mitch_2
copy my assignment into it (PATH is the path to the directory where my code resides),
% cp PATH/README ./Parry_Mitch_2
% cp PATH/p2.c ./Parry_Mitch_2
and tar it.
% tar -cvf Parry_Mitch_2.tar Parry_Mitch_2
This would tar everything in the directory Parry_Mitch_1 and put it into the file named
Parry_Mitch_1.tar.
Then email the file to parry@cc.gatech.edu.
-
You can submit as many times as you want, but only the submission closest to the due
date/time will be examined and graded.
-
No late submissions.