CS838-1 Spring 2000

Project 2: Motion Capture Viewer!

Last Modified: Monday, 20-Mar-2000 15:07:53 CST

Please check this file for updates!

Overview

The goal of this assignment is to give you a little experience in dealing with motion capture data, forward kinematics, and angle representations. Doing this assignment can give you a basic framework for a range of projects in doing motion processing.

Your task is to write a program that:

  1. Reads in motion capture data
  2. Displays the motion capture data
  3. Computes the forward kinematics
  4. Internally converts to a Quaternion form
  5. Compares Quaternion interpolation to Euler Angle Interpolation
  6. Exports marker positions.

You must also add some additional features chosen from a selected set.

Ground Rules

The assignment is intentially left a bit open in terms of the details. Some minimums are given, and you must do "more than the minimum" in at least one category. Specific "Bonus" part suggestions are made in the details sections.

You may write your program in any language (C++, MATLAB, Java, ...), may have it run on any computer, with the caveat that you will have to give a demonstration somewhere in the CS building. Note: if you choose tools that make the task harder, thats your problem.

You must document your assignment on a web page.

You are allowed to use any software libraries that we have access to. For example, you might find Quaternion and Euler angle code on the web, or use some linear algebra code. Some Quaternion and Exponential map code is provided in papers in the reader, for example.You must cite any code that you did not write in your documentation.

If you have not done any interactive 3D graphics programming in the department's computing environment, I recommend that you use the (very standard) OpenGL graphics toolkit, and the FlTk window toolkit. Andrew and I are both familiar with these, and will be able to help you if you run into trouble. Anything else, you might be on your own. Last semester, we gave "getting started guides" and example programs in class. Look at the course web for FlTk and OpenGL info.

You should work with a partner. You must pick a partner who was not involved in your project 1 team.

A Schedule is given after the assignment details.

Details

You must do at least 2 of the "Bonus" parts. Be sure to document which bonus parts you do.

Part 1 - reading in motion data

Your program must be able to read in motion capture data in the Biovision Hierarchy format (.bvh files). In the /p/graphics/public/Data/Motion/Biovision directory, I will put examples motions. There are some notes documenting the format, as well as some general info, created by Jeff Thingvold (who will be a guest lecturer later in the semester).

The file format contains definitions of the structure of the skelleton and the actual data for the parameters.

Your data parser does not have to be totally general. If you want to make assumptions about the form of the skelleton (for example, that it always has 2 arms, that the joints are Euler angles with XYZ rotation order, ...). This means that you can probably ignore the "hard parts" of parsing the data files, and hard-code it.

However, 1) you must document your assumptions, and 2) you must be able to provide at least 3 example files from the Motions directory that your program works with.

You should keep the Euler Angles internally so you can do step 5.

Beware: lots of the files were created on a PC or Mac so they might have end of line issues. You can use dos2unix (available on CS Unix machines), or make your program smart (the latter is, of course, preferred).

BONUS: make you program read and write the Acclaim format (which is documented at the BioMechanics web site) (called .asf and .amc files), at the both formats for any skelleton, so you can do conversions.

Part 2 - displaying the data

You must provide an interactive 3D Viewer (for example, using OpenGL). Your viewer must have enough of a user interface so that you can really look at a motion and see what's happening (for example, controlling the viewpoint).

Your interactive viewer should be able to "run the animation" by showing each frame, or skipping frames (in case you can't draw 30 frames per second). You should also provide a way for the user to look at individual frames.

BONUS: You may have your program import data into Maya (for example, by having it write a MEL script file) or make Renderman pictures. The output you create (e.g. Maya or Renderman scripts) should be "complete" enough that it can simply be rendered to produce an animation. If you do this bonus, please turn in a sample animation as a quicktime or avi movie.

Your pictures do not need to be fancy - "block" figures are OK - however, the display must be good enough so you can see what is going on. Nicer pictures will be appreciated.

Here is an example from a system I wrote. The "blocks" are ellipses (they look nicer). Notice the orange "traces" (see Part 3). This example also uses "strobing" where I show every nth frame (using transparency). Another thing here is the use of a groundplane and "hack" shadows (created by simply redrawing everything with the height scaled to 0).

BONUS: do "automatic cinematography." Where the camera positions (and maybe even a camera motions) are computed based on where the motion is. Describe your scheme for determining this.
Example: in looking at a walking motion, your program could have a button that gives a "profile" view of the whole motion and another button that had the camera follow the character in a tighter shot.

Part 3 - compute the forward kinematics

Your program must be able to compute the end effector positions. You can demonstrate this by displaying a "trace" of where the end effector goes over the course of a motion.

BONUS: do inverse kinematics. Allow the user to grab a hand or foot and drag it around. This is a big deal since you also have to create a 3D user interface.

Part 4 - Convert to Quaternions

Have your program store Quaternions in addition to Euler Angles. This will require you to be able to convert in at least one direction. You should have ways to look at both the Euler Angle and the Quaternion motion (and to compute the forward kinematics for each). Although you should be able to switch, the results should look the same (until we get to part #5).

BONUS: do exponential maps (as in Grassia's paper) as well. (and use it for Parts 2,3, and 5).

Part 5 - Compare Interpolation

To this point, there is no interpolation involved.

You should allow the user to specify a beginning and end frame, and rather than playing the frames in between the two frame, interpolate them (using linear interpolation, or slerps for the quaternions). That means that there are 3 different things that you need to look at (4 if you did the bonus suggested in part 4):

  1. The original motion (showing the frames between times t0 and t1)
  2. What happens when you interpolate between t0 and t1 using linear interpolation of the Euler Angles
  3. What happens when you interpolate between t0 and t1 using spherical linear interpolation of the Quaternions
  4. And What happens when you interpolate between t0 and t1 using linear interpolation of the Exponential coordinates (if you did the bonus of part 5).

You should find examples where #2 and #3 are different, and make sure you have some way in your display to show the difference between the results.

BONUS: Add some kinds of cubic interpolation (for example, Catmul-Rom, Hermite cubics where the derivatives are estimated by looking at the neighboring samples, ...). Doing the cubic interpolation for Quaternions will require you to look at the paper in SIGGRAPH '95, or some other methods are around (Johnstone and Williams "rational quaternions", for example).

BONUS: do "automatic key reduction" - that is, write a procedure that determines a set of poses to be interpolated that comes close to recreating the motion. The goal is to find as small a set of keys that work within an error bound. For example, your system might try interpolating segments of increasing length until it exceeds an error bound (interpolating from 0->9 is OK, but 0->10 has per frame error that is too high, ...)

Part 6 - Marker Export

Your program must make "simulated optical capture data" by placing virtual markers on the character and computing where these markers go. You may also want to draw (and trace) these markers positions. Note: this is an extension of part 3.

Your program must take a file with a set of lines of the form:

name joint x y z

Where name is the name of the virtual marker, joint is the coordinate system (or "bone") of theskelleton that the marker is placed on, and xyz are the coordinates of the marker in the local coordinate system of the bone. For example

LELBI LeftElbow -1 0 0

makes a maker called "LELBI" in the forearm (e.g. beneath the joint "leftElbow") that is (-1,0,0) from the center of the coordinate system (the joint).

The last line of the markers file will have the marker with the name "END."

Your program should output a datafile in the specified form.

BONUS: write a program to convert from marker positions back to skelleton configurations. This is hard, but can be made more reasonable if you make some assumptions. Talk to us to determine a set of reasonable simplifying assumptions.
Marker Format:

The format of the marker file is as follows. The first line of the file is the header. This lines is a comma separated list of all the fields which will appear on each line. The first entry of the header is the tag "KSample". This integer field refers to the sample number of the particular line. For all practical purposes this should be equal to the frame number of the animation. The next tag is "KTime", which refers to the time at which the sample was taken. The units are in seconds, and are fractional. If the motion was recorded at 10 frames per second this field should incmrement accordingly.

The rest of the field consist of the marker labels suffixed by "-X", "-Y", or "-Z" accordingly. Each marker should be presented in x/y/z order to fascilitate parsing.

Each of the following lines should contain a comma separated list of values which correspond to the fields in the comma separated list in the first line. The values should be expressed as plain ascii strings, not as binary data.

Below is output for a 5 frame example, with two markers labeled "THED" and "REAR". This example runs at a rate of 120 frames per second, and starts with the 92nd frame of the original capture sequence.

KSample,KTime,THED-X,THED-Y,THED-Z,REAR-X,REAR-Y,REAR-Z
92,0.7583,-2679.8,-73.0,1776.9,-2661.6,-186.9,1674.6
93,0.7667,-2666.8,-72.9,1777.3,-2651.1,-186.8,1675.2
94,0.7750,-2654.1,-73.0,1777.5,-2640.5,-186.8,1675.5
95,0.7833,-2641.8,-73.1,1777.6,-2629.9,-186.7,1675.7
96,0.7917,-2629.6,-73.2,1777.8,-2619.1,-186.7,1675.9

Other Bonuses

You may implement some motion editing techniques, such as filtering, motion displacement maps, automatic looping (based on cycle detection), ...

Mechanical Details

The project is due on April 13th. As per the course late policy, there is a grace period until 9:30 am on April 18th.

You must do the following checkpoints:

More details about the final hand-in will follow as well.