Hidden Surface Removal and Shading
Due: May 21, 1999
The goal of Assignment 2 is to introduce you to the basics of hidden surface
removal and surface shading. It will also introduce you to some of the
issues in interactive computer graphics and reinforce some of the issues
in 2D and 3D projections that you encountered in Assignment 1. The assignment
is in two parts, with the first part being worth 15% of your final grade
and the second part being worth 5% of your final grade. Like in Assignment
1, 13 out of the 15 possible points for the first part of Assignment 2
will be awarded for a full implementation of the assignment. The other
2 points will be awarded for creative use of 3D graphics to enhance the
quality and effectiveness of the resulting program. Grading for the second
part of Assignment 2 will be done simply on the content of the assignment
(no brownie points for excellence).
Part 1
You are to implement a modeling program that allows a user to generate
and view 3D objects. The user should be able to construct either a 3D surface
of revolution or a 3D extruded surface. A surface of revolution is
a surface that is defined by a 2D curve or polygonal line that is swept
about an axis of rotation to create a 3D surface. A 3D extruded object
is an object that is defined by a 2D polygonal line with the 3D component
defined by "extruding" the object along a line. The surface of revolution
and the extruded object should be enclosed surfaces and the interior
should not be visible. That is, capping polygons at the top and bottom
of the surface should be added to the swept surface. The objects should
be rendered with hidden surfaces removed. The surface of revolution should
use smoothly shaded polygonal faces (that is, shading should be interpolated
across the polygon faces so that the surface looks smooth). The program
should consist of two separate windows (drawing areas) or a single window
with two separate drawing areas. One drawing area should be a 2D drawing
area where the user specifies the two dimensional polygonal line that will
be used to define the 3D object. The other drawing area should be a 3D
drawing area where the 3D object is rendered.
The 2D drawing area should allow the user to specify an arbitrary polygonal
line about the x and y axes by clicking the mouse in the drawing area to
define a vertex of the polygonal line. Subsequent mouse clicks should define
subsequent vertices of the line. The user should also be able to edit the
polygonal line. Operations such as deleting the entire line, deleting vertices
in the line, and moving vertices in the line should be implemented. The
user should be able to rotate the polygonal line about the X or the Y axes
to create a surface of revolution or extrude the polygonal line along the
Z axis to define an extruded object.
The 3D rendering area should display the object with hidden lines removed
(smooth shading should be used across the polygonal faces of the swept
surface - the capping polygons do not need to be smoothly shaded).
Like in Assignment 1, you should be able to perform an animated rotation
of the object about any of the principal axes. To implement the hidden
surface removal, you should implement a simple depth sort (painters) algorithm
(by simple I mean you should sort the polygons based on some sort
of depth criteria and render them from back to front - taking care of the
many special cases in the painters algorithm is the realm of bonus points).
You are not allowed to use the OpenGL Z-buffer functionality. You
can use the OpenGL shading capabilities to perform the smooth shading of
the swept surface, but the surface must be smoothly shaded and not faceted.
The extruded object can be either faceted or smoothly shaded.
Part 2
For Part 2 of Assignment 2 you are to write a proposal for your final
project. The project is to be a work of significant size, hopefully
in an area of computer graphics that will be of interest and/or of some
use to you. Projects implementing one or more of the techniques that are
discussed in the Advanced Topics section of the course are good examples
of the scope you should be considering. For example, an appropriate texture
mapping project might be implementing a renderer that scan converts geometric
primitives and incorporates texture mapping in its illumination model.
Simply implementing texture mapping by determining what OpenGL calls to
use and writing a simple example program is not appropriate (trivial with
OpenGL). Use of OpenGL is certainly acceptable, but it must be used in
a project of the appropriate scope. Using OpenGL to implement a 3D modeling
and rendering program would be an example of an appropriate use of OpenGL's
functionality. Other example projects might be to implement a simple ray
tracer or a simple volume renderer. The key to this assignment is to find
a topic that will both interest you and satisfy the requirements of the
assignment.
The project proposal should be approximately four pages in length and
should describe the goal you have set yourself, how you will go about reaching
that goal, the deliverables of the project, and the environment that you
will be working in (OpenGL on SGI machines, for example). Feel free to
come by and discuss options with me before embarking on a proposal. In
fact, I would highly recommend that everyone come by and discuss their
proposal before you submit the assignment and possibly before you start
to write up the proposal.
Assignment Submission
To simplify submission of the assignment, everyone should create a directory
called Graphics in their home directory on the SGI machines in the Computational
Science and Engineering Lab. For each of the assignments for this course,
you should create a subdirectory beneath the Graphics directory with the
name AssignmentN where N is the assignment number (for Assignment 2 the
subdirectory should be called Assignment2). Within each Assignment directory,
you should have a subdirectory for each part of the assignment called PartM
(where M is either 1 or 2 in this case). Within each of those directories,
you should have all of the source code (C and header files), a Makefile
that will build your programs, an executable program for me to mark (it
should be named PartM as well, where M is 1 or 2), and the document for
Part 2. The modification times on the source code files, the Makefile,
the executables and the documentation should not be later than the submission
deadline. On or before the submission deadline, you should print out all
of the relevant files and give them to me or slide them under my door (CSIT
Room N328). Your code should be well documented and readable (marks will
be deducted for code that is not understandable). The executable file for
marking must be executable by group and the directory tree up to and including
the directory that contains the executable must be readable and executable
by group. You can protect the source code files from being read, but they
must be in the directory and the directory must be readable by group. In
some cases, I may want to look at the source code directly and perhaps
even recompile the program. Late assignments will be docked 1 mark per
day for each day that they are late.