Sign in to follow this  

FBX bone rotations mess

Recommended Posts

Icebone1000    1958
Im having hard times trying to organize on my head how is the info about bone tranformations stored/relationated/used on fbx sdk...

Im basing my logic on the info I get from maya and comparing it with the sdk sample Importscene, that display loads of info about a fbx file.

On maya, I did a cilinder with a skeleton made of 3 joints(top, middle and bottom):

The info I get from maia GUinterface I understand:
TOP have a Translation of ( 0; 2.5; 0 ), it have NO rotation, BUT it is 'oriented'(why the hell they dont call it a rotation) as -90 on z, lets call this RotOrient( 0; 0; -90 ).

MIDDLE have a Translation of ( 2.5; 0; 0 ), it have NO rotation OR orientation.

BOTTOM have a Translation of ( 2.5; 0; 0 )..not caring about its rotations.

This seems ok to me..since the first joint is "RotOrientated" -90 on z, the translation on X of its childs makes tottaly sense, resulting on its vertical "layout"..

What Im having difficult is with the FBX info I get..Of all transformations I see on the importscene, the only ones that have a -90 rotation on Z for TOP, ALSO have a -90 rotation on Z for MIDDLE...I guess those are absolute world transformations:
TOP: Translation( 0; 2.5; 0 ) Rotation( 0; 0; -90 )
MIDDLE: Translat( 0; 0; 0 ) Rotation( 0; 0; -90 )
BOTTOM: Translat( 0; -2.5; 0) ...

Things are still confused to me, trying explain it(with my terrible english) is a pain..

So whats the deal? The thing is with the stuff I really need, witch are the keyframe transformations. I have 2 keyframes, that blend the cilinder like an arm(the first key have NO transformations, its just its default positions):
The FBX info extracted for the keyframe transformations:
TOP: Translation( 0; 2.5; 0 ) Rotation( 0; 0; 0 )
MIDDLE:Translatio( 2.5; 0; 0 ) Rotation( 0; 0; 0 )
BOTTOM:Translatio( 2.5; 0; 0 )

TOP: Translation( 0; 2.5; 0 ) Rotation( 0; 46; 0 )
MIDDLE:Translati( 2.5; 0; 0 ) Rotation( 0; 82; 0 )
//note that it rotates pointing to Z(in the case you got confused with the Y rot)

So the confusion in my head is: I need the damn -90z rotation of TOP( cause as you see, the key transformations are hierarchy related), but this is stored as world coordinates, the transformations of keyframe animation are not..but TOP have a translation on Y on both world abs transformation and at the keyframes..with I understand I cant mix both, but stay with one..

If I pick one I get a -90 rotation on z, great..but wait, that comes with a rotation on z for middle too..if I mix those plus keyframe ones It will not result in the right thing..
If I pick just the keyframe ones, I lose the -90 rotation, with will result on the wrong thing again...

So lets say this -90z rotation is stored in any other place I still dont know..I still dont get the KEY transformations very well...the root joint TOP, in my head it should have no transformations at KEY 1, since it doesnt do anything in that frame, its just its original world cordinates(EXCEPT the damn -90z rot)...if I apply an Translation on Y of 2.5 on it it will get at y 5.0...

Shouldnt the info be:
world absolute coords:
-TOP: T( 0; 2.5; 0 ) R( 0; 0; -90 )
-MIDDLE: T( 2.5; 0; 0 ) R( 0; 0; 0 )
-BOTTOM: T( 2.5; 0; 0 ) ..

KEY 1:
-TOP: T( 000 ) R( 000 )
-MIDDLE: T( 000 ) R( 000 )
-BOTTOM: T ( 000 ) ...
KEY 2:
-TOP: T( 000 ) R ( 0; 46; 0 )
-MIDDLE: T( 000 ) R( 0; 82; 0 )
-BOTTOM: T( 000 ) ...

Thats the only way I can see things making sense..
Sorry for the terrible and long boring topic..

Share this post

Link to post
Share on other sites
RobTheBloke    2553
You need to look harder at Maya ;)

Take a look at the Node&Attr reference for joint & transform nodes (note: they are evaluated differently!). That will give you the full breakdown of how you can compute the resulting matrices. By the looks of it, you are missing the pre/post rotations (JointOrient and RotateOrient in maya), the pivots, and maybe one or two other things....

The docs for both of the nodes in maya will help immeasurably ;)

Share this post

Link to post
Share on other sites
Icebone1000    1958
Dude..I cant find anything about transform nodes on the docs..

Are you refering to those formulas:

From maya docs, joint node:

The transformation matrix for a joint node is below.

matrix = [S] * [RO] * [R] * [JO] * [IS] * [T]

(where '*' denotes matrix multiplication).

[S]: scale.
[RO]: Rotate Orient (attribute name is rotateAxis).
[R]: rotate.
[JO]: jointOrient.
[IS]: parentScaleInverse.
[T]: translate.

From FBX docs:

Here is how FBX SDK and Maya compute the transformation matrix for a node:

WorldTransform = ParentWorldTransform * T * Roff * Rp * Rpre * R * Rpost * Rp-1

* Soff * Sp * S * Sp-1

WorldTransform Transformation matrix of the node
ParentWorldTransform Transformation matrix of the parent node
T Translation
Roff Rotation offset
Rp Rotation pivot
Rpre Pre-rotation
R Rotation
Rpost Post-rotation
Rp-1 Inverse of the rotation pivot
Soff Scaling offset
Sp Scaling pivot
S Scaling
Sp-1 Inverse of the scaling pivot

I guess I only need the joint node transformation matrix? ( By what I understand, if you calculate the node transformation for a joint node, you will just waste calculations since the joint node doesnt consider many of the that right?)

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