Sign in to follow this  

Help with parsing BVH File

Recommended Posts

beachbump    100
Not sure if this is in the correct forum, but basically I can parse the BVH file with the parser I wrote but I need to get the global positions of each joint. Basically I need an array of points, one for each joint, for every frame. I want to be able to measure how different two poses are with each pose, where there is one pose for each frame. To measure the difference between two animation frames I look at the difference in positions for each joint, using a 2 norm and then having a constant that will server as a cut off for determining if 2 poses are close enough to be acceptable. The ultimate goal is to be able to read in a bunch of BVH files and create a graph were each node is a frame and there is a directed path between nodes that are close to one another. Then I will be able to search the graph for paths that adhere to certain constraints, such as turning left, turning right, ect. I want to be able to find paths, and cache these paths so that I can have real time animation changes based on user inputs as wells as 3d obstacles.

So basically I am not calculating coordinates of the joints correctly because when i animated everything the joints are just a mess. I think it has to do with how i am calculating the coordinates. Basically each joint has its own rotation channels, so I am using a quaternion class i wrote that i know works because I used it for all 3d rotations in a flight simulator i built. So for every joint there is a stack of quaternions that gets applied, where the stack represents the hierarchy of rotations. Given a joint, i take is offset then apply the location rotation and the rotations of its parents. I think however, I need to take into consideration the offsets of the parents. This would mean having to convert my quaternion objects into matricies and then do all this matrix multiplication shit that I don't want to do because I don't have time to write a matrix class right now.

But basically i am just trying to figure out how to get the global coordinates of each joint, so if there is some program out there that can tell me the coordinates of each joint for each frame, I would just save all that information to txt files and would just parse from there.

td;dr The goal is joint positions and i am getting hung up by the bvh formate motion capture data that i am using because I have to convert from heiarchical rotation and local offsets to global coordinates for each joint.

Share this post

Link to post
Share on other sites
Buckeye    10747
I don't know of any particular program that will output information in the format you describe. You'll likely have to write your own. You could, perhaps, base your code on existing software. Google for "bhv viewer source code" or similar.

As you suspect, each joint's position is relative to its parent reference frame. That includes a hierarchy of rotations and translations which can't be done with quaternions alone.

You can use matrix classes in OpenGL or DirectX (the D3DXMATRIX extensions). You don't need to initialize any rendering related objects, just use the library for matrix manipulations.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this