Comp 236 Final Project:

Animated Human

Project Abstract

I'm implementing an animated virtual human. His body is a padded skeleton represented by all the bones specified in the ASF file format. The current version has 31 specified bones. This skeleton is implemented as a hierarchical structure, as we have discussed in class, in which there is a 'root' bone. The position only of the root needs to be specified, and all other bones are specified by their relative orientation to their parent bone.
The program is able to read in an ASF file specification of the skeleton, which inputs all needed bone information: The bone's numerical id, name, direction (relative to parent bone), length, axis of rotation, and degrees of freedom. The file also specifies the limitations to the degrees of freedom (min and max values for the angles), but I do not check these in my program.
Here is a Sample ASF file.

Once the skeleton has been initialized, the program is able to read in and parse AMC files which contain motion capture data to animate the skeleton. The motion capture files (which are taken from this site) contain information about the overall skeleton position (the position of the root) and the angles of the bones relative to their local frames at each frame.
Here is an example of an AMC file snippet:
root 18.0963 17.7682 -7.76048 0.944532 -46.1634 2.4123
lowerback 4.28681 -0.118085 -2.68161
upperback -0.0248133 -0.290989 0.0933187
thorax -2.41568 -0.11332 1.61874
lowerneck -22.4034 -5.47014 -9.7586
upperneck 25.4448 -7.16285 9.12669
head 12.9471 -2.96253 3.88887
rclavicle -8.95214e-014 1.76918e-014
rhumerus -38.9866 -9.5565 -84.0352
rradius 33.5224
rwrist 3.10481
rhand -14.7847 9.11536
rfingers 7.12502

There are a different number of angles after each bone, depending on the number of degrees of freedom the bone might have.


Simple User Guide

The system controls are displayed on the right of the screen. The slider at the topmost displays the number of the current frame. The user can slide it to advance to any desired frame. Below the slider are buttons to play, pause or stop the animation. If the user presses the 'stop' button, the animation stops and reverts to frame 0, whereas if he presses 'pause', the animation stops, but remains at the current frame.

The four white square buttons can be used to change the camera view.

Below that are six sliders, which can be used to change the size of various bones on the characters that are loaded: thigh length, tibia length, upper arm and forearm length, neck length, and head radius. If more than one player has been loaded, these transforms are applied to the player that was loaded most recently. These bones can be made to be between 20% and 300% of their normal size.

On the very bottom are buttons to load a player (.ASF file), load a motion sequence (.AMC file), remove the last player loaded or exit the system.


Special Features

The program allows you to load more than one player at a time -- with a maximum of 3 players allowed. You can either load two or more players and have the "translate" check box checked, to have them loaded slightly translated from each other and give them one motion sequence which they will perform in a "chorus line," or you can load each player and load a motion sequence after each player. If the translate check box is not checked, the motion sequence you load into the system applies only to the last player loaded.

You can also check the "ghost mode" check box if you want the player to leave a trail of motions behind him. This feature still does not work well because it slows the system down considerably... However, it's fun to use for a not so prolonged period of time.

You can input values to skew (in time) the motions players perform in two ways. (This is especially fun when players are put side by side to perform the same motion sequence, but it is skewed in time). You can either slide the players' frame sliders to arbitrary values throughout the program run, or you can type in an integer value in the input button on the right of the 'translate' checkbox. The value you type in is interpreted as the number of frames by which to offset the players' motions from each other. 80 is a good default value for these short clips. When you type in the number, the program automatically detects changes. I don't have new screen shots of this (because I added the feature after the presentation), but I've updated the .exe file to this new version! _____________________________________________________________

HERE is the source code
HERE is the .exe file.

Implementation Details

I currently have 7 classes for the program:
  • main.cpp -- This is where the program starts. I build the user interface and have all callback functions here. In this class I have a pointer to a motion sequence and an instance of the display class.
  • skeleton.h -- This class implements functions to parse, extract and store the information from the ASF files.
  • motion.h -- This class implements functions to parse, extract and store infromation from the AMC files.
  • display.h -- This class maintains the list of players and has the functions for drawing the skeleton bones.
  • frames.h -- This class is used by the cameras. It computes and stores the camera-to-world and world-to-camera matrices, so toggling between camera views is easy.
  • transform.h -- Class of matrix functions.
  • vector.h -- Class of 3D vector functions.

Players loaded and translated slightly, performing the same motion sequence.

One player has been loaded to the system and has had his thighs and head enlarged.

Two players with their own motions are interacting.

Ghost Mode leaves a trail of motions behind the player.

Useful Sources and References