CS 4451 Computer
Graphics
Assignment #1
Due: Friday, February 8, 2002,
12:00 Midnight
Purpose: To demonstrate
understanding of 3D viewing.
Discussion: This assignment
is Foley, van Dam, Feiner, Hughes (FVFH) Exercises 6.1 and 6.2 for perspective
projections (Nper), with clipping in 3D (not in homogeneous
coordinates), implementing FVFH Figure 6.46. You are to write a program that
displays a (clipped) wireframe model of the house in FVFH Figure 6.24 from any
number of different views. Your program will essentially be transforming,
clipping and drawing 3D lines.
Implementation Requirements:
(Some of these requirements are for ease of grading)
- Your program must
accept from stdin the parameters defining a perspective projection
view volume, where a set of viewing parameters consists of six lines of
text. The following input format and order must be used, and
constitutes one set of view parameters (remember, the program must be able
to read any number of these sets of parameters and produce the
corresponding view each time):
Define the View Reference Coordinate (VRC)
System (and thus the view plane):
View Reference Point (VRP) - three reals: VRPx,
VRPy, VRPz
View Place Normal (VPN) - three reals: VPNx,
VPNy, VPNz
View Up Vector (VUP) - three reals: VUPx,
VUPy, VUPz
Define a window on the view plane:
Viewplane Window Bounds - 4 reals: umin,
umax, vmin, vmax
Define the semi-infinite perspective projection
view volume:
Projection Reference Point (PRP) - 3 reals: PRPu,
PRPv, PRPn
Define a finite view volume:
Front, Back Clipping Planes (F, B) - 2 reals: Fn,
Bn
An example set of parameters:
0 0 54
0 0 1
0 1 0
-1 17 -1 17
8 6 30
1 -23
Your program will be graded by redirecting to stdin
from a file, e.g: %prog1<grade.data where grade.data is the name of a file
containing sets of view parameters. Code accordingly!
- The VRC system is
right-handed: your 3D transformation matrices should reflect this (e.g., a
translation matrix should have tx, ty, tz
in the rightmost column, not the bottom row.)
- Your program will be
tested with view parameters corresponding to FVFH Figures 6.29, 30, 34, and
41, and possibly others. Your program must pause between each view,
waiting for a left mouse button press. Use either the OpenGL aux library libaux.a
or GLUT library libglut.a to provide this mouse functionality.
Test data can be assumed to be
in the correct format and order, but your program should provide an error
message (but not terminate) for input that results in an invalid or an
unreasonable view, such as the following:
- VPN is degenerate
(zero)
- VUP is parallel to
VPN
- PRP is on the view
plane
- View plane window
is reasonable (eg, umax != umin)
- B is in front of F
- Please make the
window on the display screen (viewport) 500 x 500!
- The program must be
written in C and compile and run using OpenGL on an SGI Indy workstation
in the CoC SGI lab. YOU must write the code that implements 3D perspective
viewing and clipping, and any matrix math functions. You MAY use gluOrtho2D(),
but YOU MAY NOT use the following OpenGL calls: glFrustum(), gluPerspective(),
gluLookAt(), gluProject(), glTranslate(), glRotate(), glScale().
glClipPlane().
- You must write a function
to compute all vertex/matrix functions you use (i.e. dot product, cross
product, matrix multiply, etc).
- You must write function to
perform EACH of the eight transformations (Tvrp, R,
Tprp, SHpar,
Sper, clipping in 3D, Mper, MVV3DV ).
- ALL source code you submit
must be well documented (documentation is an indicator of
understanding!)
- You MUST include a REAMDE
file that details how well your program works, any quirks it might have,
and a statement that you are trying for the extra credit (if you are doing
so.) In addition, include the name of the SGI workstation that you used to
compile and run the most recent version of your code.
- See the grading sheet for
more programming requirements.
Submission:
- Ensure your name and login name appear in each file you submit.
- Put the files you are submitting (including the Makefile you used)
in a directory on a College of Computing UNIX machine. Name your directory
last_first_1 where “last” is your LAST NAME and “first” is your FIRST NAME
(The "_1" corresponds to the assignment number). Then, from the parent directory, execute the following command:
% tar -cvf last_first_1.tar last_first_1
For example:
I would create a directory named Parry_Mitch_1,
% tar –cvf
Parry_Mitch_1.tar Parry_Mitch_1
This would
tar everything in the directory Parry_Mitch_1 and put it into the file named
Parry_Mitch_1.tar.
- You can submit as many times as you want, but only the submission
closest to the due date/time will be examined and graded.
Hints and help:
- FVFH
Chapters 6.5.2 (implementing perspective projection) and 6.5.6 (steps in
the overall viewing transformation), Figures 6.55 (clipping to the 3D
canonical perspective projection view volume) and 6.59 (matrices involved
in the viewing transformation).
- IRIS InSight on-line
documentation for OpenGL and the auxiliary and utility libraries; UNIX man
pages for OpenGL; OpenGL programming texts; http://ask.ii.uib.no/ebt-bin/nph-dweb/dynaweb/SGI_Developer/OpenGL_PG/
for openGL and GLUT library,
- Sample
code and a makefile are available on the webpage.
Grading criteria:
FVFH Figure 6.24 wireframe house
Perspective view pipeline of FVFH Figure 6.46
Clipping in 3D (NOT homogeneous coordinates,
i.e., Nper, not N’per)
- Submission
and Compilation (and following directions) ______
-5 name and login
name not on each submitted file
-5 does not accept
view parameters in the order specified
-5 no README file
(and the required information within)
-50 does not accept
view parameters input from stdin
-100 prohibited
calls used
-100 does not
compile on SGI Indy
- Documentation
______
-5 to -25
insufficiently documented (code not commented, functions not explained, etc.)
- Code
_______
-10
vector/matrix functions not used
-10
separate functions for each transform not used.
+10 Tvrp
+10 R
+10 Tprp
+10 SHpar
+10 Sper
+10 clipping in 3D
+10 Mper
+10 MVV3DV
+10 divide by W
+10 matrices constructed
and multiplied correctly, and used in the correct order
- Run-time
_____
- 40
aborts without display
-10 invalid views
not checked and handled with an error message
-5 viewport not 500
x 500
-5 does not use left
mouse button press for each new view
Extra Credit (+25 points, maximum):
Add the following capability:
- (+10
pts) Parallel and perspective projections. Use FVFH Chapter 6.5.1
for implementing parallel projection viewing. Use a GLUT pop-up menu or
the keyboard (‘p’ = perspective, ‘o’ = parallel) to select between types
of projections.
- (+10
pts) Clipping to the canonical parallel projection view volume
using the 3D Cohen-Sutherland outcode clipping algorithm (FVFH
Chapter 6.5.3).
- (+5
pts) GLUT pop-up menu is used to select between types of
projections.