Logistics
  Grading Policy
  Syllabus
  FAQ
  Links
  
  PAs:
 
   
  1. Raster Graphics
  2. 3D Scene
  3. Ray Tracing
    Posted Images
  4. Animation
  
  HWs:
 
   
  HW1
  HW2
 

Don't see the menu?

EECS487 F09: PA4

EECS487 F09 PA4: Textures, Animation, and Splines

The assignment is due on Monday 14 December 2009 at 12:01PM (one minute after noon).

Overview

In this assignment you will continue working on an X3D viewer that can render animated textured scenes. It will be an extension of the work done for PA2.

You are given support code should compile under Windows, Linux, and Mac OS X. The support code links against the Glut, Expat, PNG, and JPEG libraries. It parses an input X3D file, partially constructs a scene graph inserting various X3D nodes into it, and then passes the scene to the Glut renderer. The X3D file format is described in the X3D specification. Most tasks require modifying the file x3.cpp (look for the words YOUR CODE HERE), although some modifications in x3.h may be required. As a part of your assignment you will need to create an example X3D scene file that will show an animated humanoid (human-like) character moving through a scene.

Grading Tasks Overview (100 points total)

  1. Modify the Render and SetupTexture methods of the X3ImageTexture class to enable setting up proper texture modes and managing textures. Then modify the Render method of the X3Cylinder class to render a textured cylinder. Mipmapping should be enabled to avoid aliasing effects and alpha testing/blending should be enabled for textures that have transparency. (25 pts)
  2. Modify the Render methods of X3Box, X3Cone, and X3IndexedFaceSet to enable textured rendering. (10 pts)
  3. Modify the Render method of the X3TextureTransform class to enable texture coordinates transformations. (10 pts)
  4. Implement linear interpolation for the X3PositionInterpolator, X3ScalarInterpolator, and X3OrientationInterpolator classes to enable animated content rendering. (10 pts)
  5. Implement spline interpolation for the X3PositionInterpolator and X3ScalarInterpolator classes to enable animated content rendering with smoothly varying parameters as well as the rendering of smooth X3Curve nodes. The X3Curve node is not part of X3D, but an addition for this assignment. (20 pts)
  6. Create an X3D scene file that renders an animated humanoid walking through some scene. For full credit, the character should be textured, have two legs (comprised of upper parts, lower parts, and feet), two arms, a body, a head, and exhibit a proper walk cycle. The walking should propagate the character through the scene at the appropriate rate without sliding. It is acceptable to use cylinders and boxes for rendering the character. This is 20% of the assignment; be sure to treat it as such! (20 pts)
  7. Writeup. (5 pts)

Optional Tasks (not for any credit)

  • Add a custom particle system node to the viewer.
  • Create an ultra cool scene with a naturally moving character (moving well and then render it in your viewer).

Implementation Details

Texture setup (tasks 1 and 2)

The images are loaded by the parser and then stored as objects of Image class (image_ field stores the pointer to the image). You need to do three things to make textures show up in the viewer:

  • During scene loading, generate a new texture name and set up texturing and texture paramters for that name (texture id) within the SetupTexture method of X3ImageTexture class. You may use the gluBuild2DMipmaps helper function (but you need to understand how glTexImage2D works as well).
  • During rendering, when the X3ImageTexture::Render method is called, you need to bind the texture of the node, and possibly set up some current rendering parameters.
  • When rendering geometry, you need to specify texture coordinates for each vertex. Cylinders, Cones, and Boxes have default texture coordinate assignments as described in the X3D specification. You will need to implement these by modifying the corresponding Render methods. The indexed face sets have texture coordinates provided on a per-vertex basis, so you only need to pass these as parameters in OpenGL calls.

Texture transforms (task 3)

OpenGL can apply tranformations to specified texture coordinates before using them. This is described for the X3TextureTransform node in the X3D specification. You will need to implement it as described. This is similar to what happened in the X3Transform node; however, there is no hierarchy and no need to use the matrix stack. Just override the transforms every time X3TextureTransform is needed.

Linear interpolation (task 4)

The provided support code has some basic animation capability in the Timer, Interpolator, and Link nodes. Each link specifies which timer's time to feed into which interpolator, to update which field of which node. (The Field Update Mechanism writeup may help you understand the support code.) You are to implement a piecewise linear interpolation of the sequence of values. Given an array of keys, an array of values of the same length, and a time value, call a helper function to figure out between which two keys the time falls, and produce an in-between value. You need to support linear interpolation for three different data types: scalars, vectors, and rotations. For rotations, a simple implementation interpolates angles and axes separately. In your scenes, very often, the orientation axis will stay the same, thus you mostly need to worry about angle interpolation.

Spline interpolation (task 5)

In this task you are in the same setting as in task four; however, you need to produce a smooth interpolation using Catmull-Rom splines (with tension zero). You will only do this for the position and scalar values, not for rotations. In order to allow for easier debugging, a non-standard Curve node has been added which can have a position interpolator as a child and will then draw a curve in space that will sample that position interpolator's trajectory.

Humanoid walking (task 6)

Once you have your basic linear interpolation working, you can start creating your final animated scene. Your scene should include an articulated hierarchical character model that models a simplified structure of a human. In particular, you will need to tie together several interpolation nodes with proper rotation transformations of the skeletal links to produce a walking figure. The legs should consist of three parts each (upper leg, lower leg, and foot). Once a basic periodic walk cycle is created, you can propagate it through a scene with a translation transform. As an optional extension (i.e., not required), walk your character on a curved path (this would also require changing its orientation). Texture your character with some images to show that you have control over your scene viewer (like the head should point forward and knees bend backward). Do not worry about being overly realistic; think of your character as being a puppet/robot (though the character parts should not fly away in different directions during animation).

Support Code Details

Support code archives available on AFS at /afs/umich.edu/class/eecs487/f09/PAs/pa4.tgz run on Windows, Linux, and Mac OS X (with provided Makefiles but the use of an IDE is up to the student).

The executable should be called with one command-line argument -- the name of the X3D scene file (some scene files are provided in the data folder).

The following keystrokes are defined in the Glut window (you may map more operations to keys inside the KeyboardCallback function if you would like, but you should not change the predefined keys below).

  • ESC: quits the program.
  • SPACE: pauses/unpauses the animation.
  • RIGHT_ARROW: moves one frame forward (when the animation is paused).
  • LEFT_ARROW: moves one frame back (when the animation is paused).
  • HOME: moves to time zero (when the animation is paused).

The code needs to be linked against the Glut, Expat, PNG, and JPEG libraries. The compilation requires the corresponding header files.

Windows specific:

Copy libexpat.dll to somewhere on you path. Specify the X3D file name in the Debugging options, or run the program from a command line.

Linux specific

Download the file code-linux.tar.gz into some folder. Open console and go to that folder. Then type
tar xvzf code-linux.tar.gz
cd pa4/pa4
make
./pa4 ../data/aclock.x3d
This should bring up a scene with a clock (and it should not dump core). It should also print messages saying that textures are loaded. Then you are all set.

Mac specific

The instructions are the same as for Linux except that the user may need to install the PNG and JPEG libraries, as per PA1.

Submission Guidelines

As with PA1, to incorporate publicly available code in your solution is considered cheating in this course. To pass off the implementation of an algorithm as that of another is also considered cheating. For example, if the assignment asks you to implement sort using heap sort and you turn in a working program that uses insertion sort in place of the heap sort, it will be considered cheating. If you can not implement a required algorithm, you must inform the teaching staff when turning in your assignment, e.g., by documenting it in your writeup.

Code that does not compile will be heavily penalized. Be sure that your code compiles and works on CAEN machines. You will need to turn in your source files, together with an appropriate Makefile (and/or IDE project files), and a write-up in text format (writeup-uniqname.txt) that discusses:

  1. Your platform
  2. Anything about your implementation that is noteworthy (e.g., your method for clipping lines, or color interpolation)
  3. Feedback on the assignment.
  4. Name your file writeup-uniqname.txt. For example, the person with uniqname ysoserious would create writeup-ysoserious.txt .

Copy your code, write-up, and any other supporting files (Makefiles or IDE project files etc.) to the following directory on AFS /afs/umich.edu/class/eecs487/f09/SUBMIT/<uniqname>/pa4. This path is accessible from any machine you've logged into using your ITCS (umich.edu) password. Report any problems to ITCS.

The timestamp on your source files and your writeup will indicate the time of submission and if this is past the deadline your submission will be considered late. Therefore you are allowed multiple "submissions" without late-policy implications as long as you respect the deadline.

Test the compilation! Your submission must compile without errors and warnings on CAEN machines. Mention which platform in your write-up. 

General Information

The General Information section from PA1 applies. Please review it if you haven't read it or would like to refresh your memory.