Jump to content
  • Advertisement
Sign in to follow this  
karstux

FBX Sdk: Joint Rotation Angles?

This topic is 3081 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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
Advertisement
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:

http://www.conorgraphics.com/?p=346

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

matTransform.GetR()

and you will get the rotation in degree!

Hope it helps!

Share this post


Link to post
Share on other sites
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.

Karsten

Share this post


Link to post
Share on other sites
Kars, look at the code in that viewer and see what is the mentality behind the data extraction from FBX!
If you need other source code, I can pm you or email my own!
Hope it helps!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!