CIS 736 (Computer Graphics)
“Shiny Happy
Eople”
Sunday, 25 February, 2001
Due: Friday, 16 March, 2001
(by midnight)
This machine problem is designed to give you more experience with the OpenGL graphics programming library and help you use it to implement clipping and shading.
Refer to the course intro
handout for guidelines on working with other students. Remember to submit your solutions in
electronic form using handin and produce them only from your
own work (not common scratch work, notes, or sources other than the OpenGL
library). If you intend to use other
references (e.g., A. Watt’s books or Graphics Gems), get the
instructor’s permission, and cite your reference properly.
Grammatical Nitpick of The Month: The singular form of vertices is vertex, not “vertice”. J
1.
(10 points) Clipping. Consider a convex polygon with n
vertices being clipped against a clip rectangle. What is the maximum number of vertices in the resulting clipped
polygon? What is the minimum number? Give a proof sketch for your answer. Consider the same problem for a concave
polygon. How many polygons might
result? If a single polygon results,
what is the largest number of vertices in might have?
2.
(5 points) Parsing
new scenefiles. Refer to the notes
from the CIS736 teaching assistant, Rich T. Pickler, on the extended scenefile
format (polygon mesh models with global material and light source information,
face normals, and local color information).
Modify the scenefile parser you wrote in MP2 to load a scene and view it
in a window.
Submit a file titled mp3-2.c containing the source code that produces the final scene (this source
should compile to a binary that will be executed with one command line
arguments, i.e., mp3-2 scenefile.geo) and a README3-2 file documenting your rendering code and the basic GL functions that
you used.
3.
(35 points total) Shading
and Illumination. Consult the Angel book, Tulane OpenGL
tutorial (http://www.eecs.tulane.edu/www/Terry/OpenGL/Lighting.html#Lighting),
Red Book (OpenGL Programmer’s Guide) and Blue Book (OpenGL Reference
Manual) for this MP.
a) (10 points) Setting up the illumination model.
Refer to FVFH Section 11.1 (p. 722 –
734) for the illumination models.
Implement Phong’s illumination model (16.13) using a program that opens
and reads an illumination model file given as a command-line argument. The file will contain ka, kd,
ks, and fatt (4 values on 1 line). Note that ks is used in
place of W(q).
b) (5 points) Flat-shading a simple 3D scene
using OpenGL. Write a
program that loads a simple 3D scene such as the “new house” and applies a
perspective projection.
c)
(10 points
each) Implementing Gouraud, and Phong shading. Refer to FVFH Section 11.2 (p. 734 – 742) and HB Section 14-5 (p.
522 – 527) for the algorithm specification and examples. Implement Gouraud shading (intensity
interpolation) and Phong shading (surface normal interpolation) on an extended
scenefile.
Submit the source code that produces the shaded
scenes in the standard scene file format (to be posted), and a README3-3
file. Your program must be titled mp3-3{a|b|c|d}.c
and, when compiled with OpenGL, will be invoked with 2 command-line arguments (mp3-3{a|b|c|d}
scenefile.geo).
Extra Credit (5
points each)