Acclaim ASF/AMC
Acclaim is a game company which has been doing research into motion capture for games for many years. They developed their own methods for creating skeleton motion from optical tracker data and subsequently devised a file format, actually two files, for storing the skeleton data. Later they put the format description in the public domain for anyone to use. Oxford Metrics, makers of the Vicon motion capture system, elected to use the Acclaim format as the output format of their software.
The Acclaim format is made up of two files, a skeleton file and a motion file. This was done knowing that most of the time a single skeleton works for many different motions and rather than storing the same skeleton in each of the motion files it should be stored just once in another file. The skeleton file is the ASF file (Acclaim Skeleton File). The motion file is the AMC file (Acclaim Motion Capture data).
Parsing the ASF file
In the ASF file a base pose is defined for the skeleton that is the starting point for the motion data. Each segment has information regarding the way the segment is to be drawn as well as information that can be used for physical dynamics programs, inverse kinematic programs or skinning programs. One of the peculiar features of the ASF file is the requirement that there be no gaps in the skeleton. No child can have a non-zero offset from the end of the parent segment. This has the effect of creating more skeletal segments than are usually found in other file formats. A limitation of the ASF definition is that only one root exist in the scene, this doesn't prevent a file from cleverly containing two skeletons attached to the root but it does make such a construction clumsy.
Examine the example file "Walk.asf". In there you will see that keywords in the file all start with a colon ":". Keywords will either set global values or they will indicate the beginning of a section of data.
The ":version" keyword indicates the version of the skeleton definition. This document is for version 1.10.
The ":name" keyword allows the skeleton to be named something other than the file name.
The ":units" keyword denotes a section that defines the units to be used for various types of data. It also defines default values for other parameter. Any number of specifications may be found here, the use of these values are often program specific. Ideally you should store these values and then write them out again if you make modifications to a file. If you intend to just read the motion data in then you can ignore those values that don't interest you. In this section you will find the units used for angles and sometimes the default values for mass and length of segments.
The ":documentation" section allows for the storage of documentation information that will persist from one file creation to the next. Simple comment information in the file is not guaranteed to be retained if the file is read into memory than saved to another file, possibly with modifications.
The ":root" section defines a special segment of the scene (well, it's special to the way the file format is defined, you can really treat this just like any other segment in all other ways). This is the root segment of the skeleton hierarchy. It is much like all the other segments but doesn't contain direction and length information. The "axis" keyword in the root section defines the rotation order of the root object. The "order" keyword specifies the channels of motion that are applied to the root and in what order they will appear in the AMC file. The "position" and "orientation" keywords are each followed by a triplet of numbers indicating the starting position and orientation of the root. These are typically, but not always, zero.
The ":bonedata" section contains a description of each of the segments in the hierarchy. These descriptions are for just the segments. The hierarchy section, which comes next, will describe the parenting organization of the segments. The segment definition is bracketed by a "begin" and "end" pair of keywords (note the lack of a colon in each keyword). Within the segment definition you will find:
Parsing the AMC file
The AMC file contains the motion data for a skeleton defined by an ASF file. The motion data is given a sample at a time. Each sample consists of a number of lines, a segment per line, containing the data. The start of a sample is denoted by the sample number alone on a line. For each segment the segment name appears followed by the numbers in the order specified by the dof keyword in the ASF file.
Interpreting the data
For each segment it is useful to precalculate some the transformation matrices that will be used to construct a global transform for a segment. First create a matrix C from the axis using the axis order to determine the order the rotation values are composed. In the ASF file the order is given left to right so that an order of "XYZ" is:
vM = vXYZ
Do this same calculation for the root but use the orientation value with the axis order for the root. After calculating C take the inverse of C, call it Cinv, and save it.
Next create a matrix B and from the translation offset from the segments parent. The translation offset is the direction and length of the parent segment. For the root use the position value. This concludes the precalculation step.
When constructing the transformation matrix of motion for a segment first create a matrix, M, of the motion data. When creating M construct a separate matrix for each dof specification and multiply them together left to right. Compose the local transform, L, by multiplying M on the left by Cinv and on the right by C then B:
L = CinvMCB
Like with other formats create the full transform by traversing the hierarchy and multiplying on the right by each parent in the skeleton.