Sign in to follow this  
SapphireStorm

Animation File Format

Recommended Posts

Hi guys,

I'm trying to reverse engineer an animation pipeline and I've ran into a problem.

I have three types of files. The first represents the geometry of a model in its default pose. The second file contains bone information for the model. This file contains all bone names, absolute orientations (as quaternions), and absolute positions (as vectors) for the model in its default pose.

At this point, I can go out and render a model with its default bones as cubes in the same scene and everything appears correct. The bones appear to align in positions a character rigger would want to place them for the animators.

Finally, I have a file containing an actual animation. It has all the key frames for the animation where each key frame contains a quaternion and a vector for each bone. This is where I'm stuck. I don't know how this data correlates to the default pose data or what I should be doing with it.

Some random information about the data:
- rendering as if it were absolute appears as garbage.
- converting to absolute using the root bone as the starting point and then rendering appears as garbage.

So, I don't know really what else to say. I am kind of hoping there's "standard" procedure everyone uses for this. I'm kind of assuming you need to convert the bone representations into the same space and then do something.

Share this post


Link to post
Share on other sites
You can't render animation data - you use it to animate the position and orientation of bones.
Here's how I do it:

[code]
struct PositionKey
{
int frame;
Vector3 position;
};
struct RotateKey
{
int frame;
Vector4 quaternion;
};
[/code]
Every bone has a std::vector<PositionKey> and a std::vector<RotateKey>. (They also have scale keys, which I have never seen used but are still there for compatibility). It should be obvious how these are loaded into the bone structure.
Then when you call SetFrame(frame) on the bone, it searches through all its keys, finding two that lie before and after the requested frame, and lerping between these to create the pose.

Also, do your files contain vertex indices/weights for the bones? Or are these stored as vertex elements?

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