Handed out: Feb 22, 2008
Due: 11:30am, March 5, 2008
1. You will write a program that uses perspective projection to render 3D lines.
2. You may use either your line-drawing algorithm from assignment 2 or use OpenGL lines.
3. You must use 'depth-cueing' to color your lines. Depth cueing means that colors fade to darker (not black) when using a black background, or fade toward white when using a white background. Please use a black background. You should not fade to complete black but interpolate the color along the line. OpenGL will do this if you setup the state appropriately (assign colors to vertices based on the projected Z values).
4. You must use the orthographic projection from the example assignment for the OpenGL PROJECTION matrix. This means you should either place your projection matrix on the MODELVIEW stack or use your own matrix multiple routine for the projection. I recommend using your own matrix multiply since you will need the projected depth information to determine the endpoint color for depth-cuing. That is, you'll have to project in your code anyway! You can use your own line-drawing or OpenGL lines once you know the appropriate endpoint color.
5. Your projection matrix can assume a resonable field of view as in the example images. You need to make sure your viewing frustum maps to: right = 0, left = 511, top = 511, bottom = 0 to accommodate the orthographic projection. Since the orthographic projection assumes 0-511, you can not map to the canonical viewing frustum which would typically be the case! This will require that you think about, and setup, the Mpersp appropriately. You may not use the OpenGL perspective routines you must develop the matrix yourself. Be sure to document what you did in the writeup!
6. Your 'object' will be read from an input file. It will consist of a series of lines forming quadrilaterals. The quadrilaterals will form the object. Your object will be closed and convex. For example, a cube will have 6 such quadrilaterals (six LINE statements in the input file).
LINE X0 Y0 Z0 X1 Y1 Z1 r1 g1 b1 r2 g2 b2
There may be extra spaces inbetween the data in the input line (use fscanf or something similar rather than reading characters).
Here's a test file: testfile Testfile (cube)
7. Your object should spin with speed controls as in the last assignment controlling the spin. It should spin about the 'Y' axis (the vertical axis).
8. You should draw the result into a 512x512 window.
9. You must turn in documentation in the form of a webpage as in the other assignments.
10. Extra credit for hidden line removal.
The program should draw its output to an OpenGL window of size 512x512 as in the example program.
use the handin routine in the CADE Lab. You can with zip or tar your solution. You should comment your code appropriately and hand in a web-page that will serve as complete documentation. Please include a paragraph of difficulties and a paragraph of what you learned in this assignment.
The handin name for this lab is "lab5".
Windows users should use the Zip utility and handin a single zipped file. Unix users should use the tar program to do the same. We will recompile the programs to grade them. Make sure your workspace/program will compile for us. That is, be careful about your user-specific pathname variables! If you do this on a home machine, please allow sufficient time for porting to the CADE machines. We will grade based on compiling and running on the CADE machines.
Due to a bug in the handin program, do not include spaces in the names of the files that you submit, otherwise we will not receive them. For instance, "no spaces.txt" is not a valid filename and would not be received, while "no_spaces.txt" is valid. Please keep this in mind while handing in your assignment.