FBX bone rotations mess

Started by
2 comments, last by Icebone1000 13 years, 6 months ago
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):
o
|
o
|
o

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):
o...o.
.\./..
..o...
The FBX info extracted for the keyframe transformations:
KEY 1
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 )

KEY 2
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..
Advertisement
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 ;)
Dude..I cant find anything about transform nodes on the docs..

Are you refering to those formulas:
Quote:
From maya docs, joint node:

The transformation matrix for a joint node is below.

matrix = * [RO] * [R] * [JO] * [IS] * [T]<br><br>(where '*' denotes matrix multiplication).<br><br> : scale.<br> [RO]: Rotate Orient (attribute name is rotateAxis).<br> [R]: rotate.<br> [JO]: jointOrient.<br> [IS]: parentScaleInverse.<br> [T]: translate.<br><br><br>From FBX docs:<br><br>Here is how FBX SDK and Maya compute the transformation matrix for a node: <br><br>WorldTransform = ParentWorldTransform * T * Roff * Rp * Rpre * R * Rpost * Rp-1<br><br> * Soff * Sp * S * Sp-1<br><br>WorldTransform Transformation matrix of the node <br>ParentWorldTransform Transformation matrix of the parent node <br>T Translation <br>Roff Rotation offset <br>Rp Rotation pivot <br>Rpre Pre-rotation <br>R Rotation <br>Rpost Post-rotation <br>Rp-1 Inverse of the rotation pivot <br>Soff Scaling offset <br>Sp Scaling pivot <br>S Scaling <br>Sp-1 Inverse of the scaling pivot <br><!–QUOTE–></td></tr></table></BLOCKQUOTE><!–/QUOTE–><!–ENDQUOTE–><br><br>I guess I &#111;nly 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 parameters..is that right?)
Hi..

Theres a method of KfbxAnimEvaluator, GetGlobalTransform, seems it returns this formula..
Just sharing..

This topic is closed to new replies.

Advertisement