Homework Assignment 2 (Machine Problem)

 

Monday, 18 February 2002

Due: Friday, 09 March 2002 (by 5pm)

 

 

The programming component of this assignment is intended to apply your understanding cubic curves and introduce you to the some standard illumination models used in computer graphics.

 

Refer to the course intro handout for guidelines on working with other students.

Note: Remember to submit your solutions in electronic form using hwsubmit and produce them only from your personal notes (not common work or sources other than the textbook or properly cited references).  No handwritten solutions, please.

 

1. (25 points) ”Flying through” a simple 3D scene.  In this machine problem, you will design and implement two “camera tracks” to display a fly-through animation of the 3D scene from machine problem 1.

 

a)             (10 points) Draw a 3D wireframe scene with 2 connected components (2 cubes or 2 houses, for example).  You may reuse single objects from machine problem 1.

b)             (15 points) Implement a Bézier curve that flies through this scene, subject to the following view specification:

 

§         Both components of the scene should be visible for part of the animation.              

§         In part of the animation, one of the components should partially occlude the other. You do not have to perform visible surface determination for this machine problem.

§         The camera (eyepoint) should pass through one of the components.

 

To complete this problem, you need to:

-          Write down the appropriate control polygon endpoints in world coordinates for the scene you drew in part (a).

-          Use either the OpenGL Bézier code or deCasteljau’s algorithm (as specified in Section 11.2.7 of Foley et al) to interpolate each segment of the curve.

 

At each interpolated point, call gluLookAt() to update the view.  When your interpolation granularity is fine enough, you should get a smooth animation.

 

2.        (5 points) Parsing new scenefiles.  Refer to the notes from the CIS736 teaching assistant 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 MP1 to load a scene and view it in a window.

 

Submit a file titled mp2-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., mp2-2 scenefile.geo) and a README2-2 file documenting your rendering code and the basic GL functions that you used.

 

 

 

 

 

3.        (20 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) 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.

 

b)       (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(α). 

 

 

 

Class Participation (Required)

Gouraud shading.  Refer to FVFH Section 11.2 (p. 734 – 742) and HB Section 14-5 (p. 522 – 527) for the algorithm specification and examples.  You need to implement this for your machine problem 4.

 

Post your questions regarding this problem in the class web board (http://groups.yahoo.com/group/ksu-cis736-spring2002).