Introduction
BVH, for Biovision hierarchical data, was made by the motion capture company Biovision to deliver recordings to its customers, largely replacing its earlier BVA format by adding the skeleton. It is plain text and is still widely exchanged between animation programs.
Structure
A file has two parts. HIERARCHY defines a tree of joints, each with its
offset from its parent and a list of channels. MOTION gives the number of
frames, the time between them and then one line of numbers per frame, one number for
every channel in the order the channels were declared.
HIERARCHY
ROOT Hips
{
OFFSET 0.00 0.00 0.00
CHANNELS 6 Xposition Yposition Zposition Zrotation Xrotation Yrotation
JOINT Chest
{
OFFSET 0.00 5.21 0.00
CHANNELS 3 Zrotation Xrotation Yrotation
End Site
{
OFFSET 0.00 18.65 0.00
}
}
}
MOTION
Frames: 2
Frame Time: 0.033333
0.00 35.00 0.00 0.0 0.0 0.0 0.0 0.0 0.0
0.00 35.10 0.50 0.0 2.0 0.0 0.0 5.0 0.0
Hierarchy section
| Keyword | Meaning |
|---|---|
HIERARCHY | First line of the file. |
ROOT name | Starts a skeleton. A file may in principle hold several, each with its own ROOT. |
{ } | Enclose a joint’s contents, each brace on its own line. |
OFFSET x y z | Position of the joint relative to its parent; usually zero for a root. It also gives the length and direction used to draw the parent segment. |
CHANNELS n label… | n channel labels for this joint. |
JOINT name | A child joint, with the same contents as a root. |
End Site | Ends a chain. Its block holds only an OFFSET, the tip of the last segment; it has no channels. |
Indentation is one tab per level. It is for readability, but some programs expect tabs, so writers should use them rather than spaces. There is no information on how a segment is to be drawn; programs usually infer it from the offset of the first child.
Channels
| Label | Value in each frame |
|---|---|
Xposition, Yposition, Zposition | Translation along the axis, in the units of the offsets |
Xrotation, Yrotation, Zrotation | Rotation about the axis, in degrees |
A joint may in principle have any number of channels in any order. Nearly all files give the root six (three positions and three rotations) and every other joint three rotations, commonly in the order Z, X, Y.
Motion section
| Line | Meaning |
|---|---|
MOTION | Starts the section. |
Frames: n | Number of frames; the colon is part of the keyword. |
Frame Time: t | Seconds between frames; 0.033333 is 30 frames a second. |
| then n lines | One frame each: all channel values, separated by spaces or tabs, in declaration order through the tree. |
With many joints a frame line becomes long, which troubles readers that limit line length.
Computing positions
- The coordinate system is right-handed, with Y usually taken as up.
- Each joint has a local transform made of a rotation and a translation. The translation of a joint without position channels is its
OFFSET. - The rotation is composed in the order the rotation channels are listed. For
Zrotation Xrotation Yrotation, a column vector is multiplied by R = Rz Rx Ry (in row-vector notation, v Ry Rx Rz). - A joint’s global transform is its local transform followed by that of its parent, and so on up to the root.
- The format has no scale, and no rotation in the rest pose: only offsets define it.
Divergence from the specification
The usual description is a university course page; there is no vendor specification. Programs differ from it as follows.
| Point | Course description | Blender add-on | Assimp |
|---|---|---|---|
| Position channels | Added to the OFFSET (said of the root) | Taken as the position relative to the parent, so the offset is not added; the exporter writes values that include it | Replace the offset |
| Several roots | Allowed | A source comment leaves it open; for several root bones the exporter writes one empty parent root with CHANNELS 0, named __0 or similar | One only: MOTION must follow the first tree |
| Keywords | As written above | Case ignored | Case matters |
| Layout | One item per line, tabs | Reads line by line and expects the brace, OFFSET and CHANNELS on the lines after the name; also accepts bare CR line ends | Reads word by word, so line breaks do not matter |
| Joint names | One name | Joins several words with _ and numbers duplicates (.001) | One word |
| Position channel count | Any | Any | Reads positions only on joints with exactly six channels, which must include all three |
Name after End Site | None | Ignored if present | Not accepted |
In the explorer
A dropped .bvh file shows every statement of the hierarchy and every frame
in the byte tree. The skeleton is played in 3D at the file’s frame time, and shown at
rest in a tab of its own. Tables list the joints and end sites, the channels in the order
of a frame’s values, every frame and every value; a frame in the table opens as a pose
with its values. Where an offset and a position channel of the same axis make the two
readings in the table above differ, both can be chosen.
Several roots, keywords in another case and values that do not run one frame a line are read, and listed as problems where another reader would differ. Files up to 256 MB are read.
Links
Software
- Blender – imports and exports BVH through its motion capture add-on (Windows, macOS, Linux)
Developers
- Assimp – model import library with a BVH loader (C++)
- Blender BVH add-on – importer and exporter (Python)
Reference
- Biovision BVH – the usual description, from a University of Wisconsin course, 1999
- Example1.bvh – the example file it discusses
- Assimp BVHLoader.cpp – loader source
- Blender import_bvh.py – importer source