Source Code:
The source code for the AMC viewer is at /afs/cs.cmu.edu/academic/class/15464-f05/asst1/src_viewer/
the code for linear interpolation for euler angles is at /afs/cs.cmu.edu/academic/class/15464-f05/asst1/src_interpolate/
and the motion data files are at /afs/cs.cmu.edu/academic/class/15464-f05/asst1/data/
You may have to do the following to get the code running:
setenv LD_LIBRARY_PATH /afs/cs/academic/class/15464-f05/lib/
begin
id bone_id
//Unique id for each bone
name bone_name //Unique
name for each bone
direction dX dY dZ //Vector describing direction
of the bone in world coordinate system
length 7.01722
//Length of the bone
axis 0 0 20 XYZ
//Rotation of local coordinate system for
//this bone relative to the world coordinate
//system. In .AMC file the rotation angles
//for this bone for each time frame will be
//defined relative to this local coordinate
//system
dof rx ry rz
//Degrees of freedom for this bone.
limits (-160.0 20.0)
(-70.0 70.0)
(-60.0 70.0)
end
The parent/child relationship among all bones in the skeleton hierarchy
is defined in the ":hierarchy " section of the .ASF file. Each line lists
the parent first, then its children.
For example:
"root lhipjoint rhipjoint lowerback"
Root is a parent and lhipjoint, rhipjoint, lowerback are root's children.
The following picture shows the skeleton hierarchy as defined in ASF file (length of the bones is not up to scale).
Picture 1. Shows the skeleton hierarchy, in particular name and id for each bone as defined in .ASF file.The next figure shows rotation axes and names of some bones. In the user interface for the program (the joint box) you can view the local coordinate system for each bone by entering its bone index, which is defined in .ASF file.
Picture 2. Shows local coordinate system for some of the bones.
For a brief introduction on mocap file format, you can look at http://www.cs.wisc.edu/graphics/Courses/cs-838-1999/Jeff/ASF-AMC.html
The motion file (.AMC) records each bone's rotation angles (Euler angles) relative to the bone's local coordinate system at each time step, where the local coordinate system for each bone is defined in the skeleton (.ASF) file.
Running the code:
Make sure there is a "Skeleton.ASF" file in the working directory since
it is the default skeleton file used in the program. A simple camera control
is provided. You can drag the left mouse button to rotate about the character,
middle mouse button to zoom in/out, and the right mouse button to move
around. You can view the rotation axes of each bone by entering its bone
index, which is defined in skeleton (.ASF) file and shown in picture 1.
Steps to display the animation:
The offset files are provided to you together with the sampled motion files. Each offset file will have the same name as the corresponding motion file, with suffix "_offset.txt" at the end.
Offset file format:
One integer per line. Each integer represents the time frame in the
original motion for each sample in the sampled motion.
Example:
1
(First sample in sampled motion corresponds to frame 1 in the original
motion)
17
(Second sample in sampled motion corresponds to frame 17 in the original
motion)
22
(Third sample in sampled motion corresponds to frame 22 in the original
motion)
....
(And so on. Number of lines in the file is equal to the number of frames
in sampled file)
The current "interpolate" executable writes the results in a file called "interp.AMC". The file "walk_turn.AMC_samp20_interp.AMC" in the "src_interpolate" directory is the result of doing linear interpolation using euler angles on "walk_turn.AMC_samp20.AMC". The interpolated motion can then be viewed by the amc_viewer.