Sign in to follow this  

FBX Sdk: Joint Rotation Angles?

Recommended Posts

karstux    100
Dear all, I hope my problem isn't too 'beginnerish'. I'm working in a scientific institution, and we're trying to analyze motion capture data in terms of motion sources. To do this, we have animated characters in Autodesk Motionbuilder (with the mocap data), and now I'm tasked with extracting the skeleton joint angles from the resulting FBX files. You'd think that's easy, but frankly, I'm completely lost... I need to get the joint angles in either Euler angles, axis-angle or quaternion format, in the bone's local coordinate system, for each frame of the animation. (Euler Angles would be best, because these can be directly plugged into Horde3D, which we use for visualization...) The FBX SDK documentation seems quite unclear on how to obtain this. There's a lot of attributes (PreRotation, PostRotation, LclRotation, RotationOffset, GeometricRotation) and methods (GetPreRotation(), GetPostRotation(), GetRotationOffset(), GetDefaultR(), GetLocalRFromCurrentTake()) that seem to apply, but often enough, I'm not even sure how to interpret the vectors that they return; much less how to combine them. I'd be very grateful for any pointers in the right direction. Karsten Rohweder

Share this post

Link to post
Share on other sites
JorenJoestar    381
Hi Karsten!
I'm using FBX as import format for my engine, and some days ago I found a solution in the messy world of FBX...

You can begin with the complete source code coming from this guy:

DirectX10, and I've tested it with the last FBX SDK (apart for a method): it requires also NVidiaPhysX, but you can comment the code and still import a complete skinned file.

The mentality behind the informations per bone is that:

for each animation (called "take") you traverse the fbx file to find the elements that you need (in many case are nodes with attribute set to eSKELETON) and for each element you take all the transformations during the time of all the animation.

For each keyframe, you can find the transformation relative to the parent like that:

KFbxXMatrix matAbsoluteTransform = GetGlobalFromCurrentTake(pNode, takeTime);
KFbxXMatrix matParentAbsoluteTransform = GetGlobalFromCurrentTake(pNode->GetParent(), takeTime);

KFbxXMatrix matTransform = matAbsoluteTransform * matParentAbsoluteTransform.Inverse();

N.B. In the source I've linked you, the order of the matrix multiplication is inverted because of the difference between FBX and DirectX matrix differences (row/column order).

Now matTransform contains the rotation, translation and scale. To obtain the rotation, simply call


and you will get the rotation in degree!

Hope it helps!

Share this post

Link to post
Share on other sites
karstux    100
Hi Joren,

thank you very much for your helpful reply! That is indeed useful code. I don't have it working quite yet, but my results look already more correct than they did before. :) I'll definitely post my code when I figure it out.


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