EECS487 F07 Project 3: Textures, animation, and splines.

The project is due on Monday, November 19th, 2007 at 11:59pm.

Turning it in 48 hours earlier is worth a 4% bonus, turning it in 24 hours early is worth a 2% bonus.

Overview

In this project you will continue working on an X3D viewer that can render animated textured scenes.

You are given support code for this project that should compile under Windows and Linux. Support code links against 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 specs. Most of your tasks will be modifying the file x3.cpp (look for 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-like character moving through a scene.

Grading tasks overview (100 points total).

  1. Modify Render and SetupTexture methods of X3ImageTexture class to enable setting up proper texture modes, and managing textures. Modify Render method of X3Cylinder class to render a textured cylinder. Mipmapping should be enabled to avoid aliasing effects. Alpha testing/blending should be enabled for textures that have transparency channel. 25pts
  2. Modify Render methods of X3Box, X3Cone, and X3IndexedFaceSet to enable textured rendering. 10pts
  3. Modify Render method of X3TextureTransform class to enable texture coordinates transformations. 5pts
  4. Implement linear interpolation for X3PositionInterpolator, X3ScalarInterpolator, and X3OrientationInterpolator classes to enable animated content rendering. 10pts
  5. Implement spline interpolation for X3PositionInterpolator and X3ScalarInterpolator classes to enable animated content rendering with smoothly varying parameters, as well as rendering of smooth X3Curve nodes. 20pts
  6. Create an X3D scene file that would render an animated humanoid-like model walking through a scene. For full credit, the character should be textured, have two legs, two arms, a body, a head, and a proper walk cycle. The walking should propagate the character through the scene. It is okay to only use cylinders and boxes for rendering the character. 20pts
  7. Writeup. 10pts

Extra credit tasks.

Implementation details.

Texture setup (tasks 1 and 2).

The images are loaded by the parser, and are 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:

Texture transforms (task 3)

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

Linear interpolation (task 4)

The provided support code has some basic animation capability by using Timer, Interpolator, and Link nodes. Each link specifies which timer's time to feed into which interpolator to update which field of which node. In the task 4, all you need to do is to implement a piecewise linear interpolation of the sequence of values. You are given an array of keys and array of values of the same length. Now, given a time value, a helper function is called to figure out between which two keys the time falls. Then all you have to do is to produce an in-between value for three different data types: scalars, vectors, and rotations. For rotations, a simple implementation will simply interpolate 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 (tension zero, section 15.5.3 of our textbook). You will only to do this for position and scalar values, no rotations. In order to allow for easier debugging, I added a non-standard Curve node 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, which should have an articulated hierarchical character model which has 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 two parts each (upper and lower leg). Once a basic periodic walk cycle is created you can propagate it through a scene with a translation transform. For extra credit, walk your character on a curved path (this would also require changing its orientation). See section 16.4 of the book for an example of the human skeleton structure. Texture your character with some images to show that you have control over your viewer (like the head should point forward and knees bend backwards). Do not worry about being overly realistic, think of your character as being a puppet/robot. (The character parts should not fly away in different directions during animation though).

Code quality.

  1. Comment your code reasonably, particularly your design decisions and choice of approach.
  2. Modularize your code: use a suitable number of helper functions/classes with descriptive names.
  3. Use descriptive variable and function names: use a reasonable tradeoff between symbol-length and desriptiveness.
Bottom line: make your code readable. We will take up to 10 points for code that is unreadable.

Support code details.

First of all, download the support code archive

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

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

The code needs to be linked against glut, expat, png, and jpeg libraries, and the compilation requires the corresponding header files.

Windows specific:

Copy libexpat.dll and glut32.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 p3.tgz into some folder. Open console and go to that folder. Then type
tar xvzf p3.tar.gz
cd p3/proj3
make
./proj3 ../data/aclock.x3d
Now 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.

Submission guidelines.

Make sure your code compiles and works on CAEN Linux or Windows machines. You will need to turn in

Your writeup should discuss:
  1. Anything about your implementation that is noteworthy
  2. Any extra credit portions you completed.
  3. Feedback on the assignment.
  4. Name your file writeup-<uniqname>.txt

We'll post the detailed submission instructions in the very near future.

Do not submit any binary files (object, executable, or image) with your project.

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' as long as you respect the deadline. The submission folders will also be closed for writing right after the deadline.

Test the compilation: Your submission must compile without errors and warnings on supported platforms. Mention the platform in your writeup. Code that doesn't compile will be heavily penalized.

Appendices