CIS 736 (Computer Graphics)

Spring, 2004

 

Homework Assignment 1 (Machine Problem)

 

Wednesday, 18 February 2004

Due: Friday, 05 March 2004 (by 5pm)

 

 

The programming component of this assignment is intended to apply your understanding of the mathematical foundations of computer graphics and give you an introduction to or refresher in the OpenGL programming library.

 

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

Note: Remember to submit your solutions in electronic form by uploading a .zip, .tgz, or .bz2 archive (zipped using the pseudonumber that you will receive by e-mail as the password) 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.  Your solutions must compile and run on the KDD Core systems under Linux/MESA (e.g., Anaire, Ecthelion).

 

 

OpenGL Programming Warm-Up

 

1. (10 points) Drawing a simple 2D scene. Construct a simple 2D scene, in color, containing at least the following primitives:

-          Circles or ellipses

-          Irregular polylines and polygons

-          Regular polygons

and render it using an OpenGL program (you may write this in C or C++).  For example, draw a side-view orthographic projection of your car.

 

Submit a file titled mp1-1.c containing the source code that produces the final scene (this source should compile to a binary that will be executed with no command line arguments, i.e., mp1-1) and a README1-1 file documenting your rendering code and the basic GL functions that you used.

 

2.  (10 points total) Drawing a simple 3D scene and using the matrix stack.  Construct an original 3D scene, depicting a simple object such as the house in Chapter 6 of FVD, and apply the following views using

 

- glFrustum()

- glMatrixMode(), glLoadIdentity(), glOrtho()

- gluLookAt()

 

in OpenGL (see Sections 5.1, 5.5.1, 5.8, and 5.9 of Angel 3rd Edition):

 

      (5 points) 2-point Perspective – 5.1.1, 5.1.5

 

(5 points) Parallel

·         Top, side, and front view orthographic – 5.1.2

·         Dimetric axonometric – 5.1.3 (p. 220) Angel

·         Cabinet (oblique) – 5.1.4 Angel, Fig. 6.11 (p. 236) FVFH

 

Submit the source code that produces the projections, your scene file (titled scene1-2) in the standard scene file format (to be posted), and a README1-2 file.  Your program must be titled mp1-2.c and, when compiled with OpenGL, will be invoked with 2 command-line arguments (mp1-2 n scenefile), where n stands for:

 

  1. 2-point perspective
  2. top-view
  3. side-view
  4. front-view
  5. dimetric
  6. cabinet

 

3.  (15 points total) Shadows and light sources (exercise 5.16, Angel 3e). Refer to the Neon-Helium (NeHe) tutorial..  Write a program to display a rotating tetrahedron in a box with three light sources.  Each light source should project the cube onto one of the three visible sides of the box.

 

      Submit a file titled mp1-3.c containing the source code that produces the final scene (this source should compile to a binary that will be executed with no command line arguments, i.e., mp1-3) and a README1-3 file documenting your rendering code and the basic GL functions that you used.

 

4.  (15 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 a modified 3D scene from Machine Problem 1.

 

a)             (5 points) Draw a 3D flat-shaded scene with 2 connected components (2 cubes or 2 houses, for example).  You may reuse single objects from Machine Problem 1.

 

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

 

Submit a source file mp1-4.c with a Makefile if you have multiple sources (note: your MP solution will be graded only if you submit either a single source file or a Makefile that works under a Unix system, such as the KDD Core Linux systems).

 

 

 

 

Class Participation (Required)

 

Post an introduction by reply to the instructor’s post in the class web board (http://groups.yahoo.com/group/ksu-cis736-spring2003) and your Turn-to-A-Partner exercise from class (Fri 18 Feb 2004).

 

 

Extra Credit (Optional)

 

(5 points) Add a ninth command-line option (mp1-3 6 scenefile) that displays the 1-point perspective projection, but set up the viewing and normalizing transformation matrices yourself using VRP, VPN, VUP functions as documented in Section 5.3.2 of Angel 3e.  Your code (mp1-extra.c) will be inspected.

 

Look ahead to remaining homeworks

Machine Problem 2: Splines and curved surfaces in OpenGL; more 3D rendering

Machine Problem 3: Raytracer part I

Machine Problem 4: RenderMan & Maya

Machine Problem 5: Raytracer part II – radiosity