Community
FBX Forum
Welcome to Autodesk’s FBX Forums. Share your knowledge, ask questions, and explore popular FBX topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GetNodeGlobalTransform issues

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
397 Views, 4 Replies

GetNodeGlobalTransform issues

Hey everyone,

I'm having trouble with the Python FBX 2012.2 SDK. I'm trying to export the animation matrices for a bone hierarchy, and I'm using scene.GetEvaluator().GetNodeGlobalTransform(..) for that. It seemed to work fine on my test set, but I'm having trouble with new models that I received. The files are all generated with Maya 2012.

One model has a scaling issue. With GetNodeGlobalTransform, everything up to the pelvis bone is fine using the correct scaling. But any bone below the pelvis scale suddenly has the scale pretty much reverted. Evaluating the bones in maya using xform shows that GetNodeGlobalTransform apparently computes wrong matrices.

Here is the code snippet:


... for every node in the hierarchy ...
print "***** Bone: "+bone_name
if node.GetParent():
print "Parent: "+node.GetParent().GetName()
scene.GetEvaluator().InvalidateNode(node)
print "Local Translation", scene.GetEvaluator().GetNodeLocalTranslation(node, fbx_frame_time)
print "Local Rotation", scene.GetEvaluator().GetNodeLocalRotation(node, fbx_frame_time)
print "Local Scale", scene.GetEvaluator().GetNodeLocalScaling(node, fbx_frame_time)
mat = scene.GetEvaluator().GetNodeGlobalTransform(node, fbx_frame_time)
print "Global Matrix"
print mat.GetColumn(0)
print mat.GetColumn(1)
print mat.GetColumn(2)
print mat.GetColumn(3)


And it produces


***** Bone: RootNode
Local Translation fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
Local Rotation fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
Local Scale fbx.KFbxVector4(1.000000, 1.000000, 1.000000, 1.000000)
Global Matrix
fbx.KFbxVector4(1.000000, 0.000000, 0.000000, 0.000000)
fbx.KFbxVector4(0.000000, 1.000000, 0.000000, 0.000000)
fbx.KFbxVector4(0.000000, 0.000000, 1.000000, 0.000000)
fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
***** Bone: Bird:Bird_Master
Parent: RootNode
Local Translation fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
Local Rotation fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
Local Scale fbx.KFbxVector4(0.089513, 0.089513, 0.089513, 1.000000)
Global Matrix
fbx.KFbxVector4(0.089513, 0.000000, 0.000000, 0.000000)
fbx.KFbxVector4(0.000000, 0.000000, -0.089513, 0.000000)
fbx.KFbxVector4(0.000000, 0.089513, 0.000000, 0.000000)
fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
***** Bone: Bird:Bird_Pelvis
Parent: Bird:Bird_Master
Local Translation fbx.KFbxVector4(33.576431, -81.108955, 98.328041, 1.000000)
Local Rotation fbx.KFbxVector4(0.000000, -43.811520, 0.000000, 1.000000)
Local Scale fbx.KFbxVector4(1.000000, 1.000000, 1.000000, 1.000000)
Global Matrix
fbx.KFbxVector4(0.064594, 0.000000, -0.061969, 3.005521)
fbx.KFbxVector4(-0.061969, 0.000000, -0.064594, -8.801620)
fbx.KFbxVector4(0.000000, 0.089513, 0.000000, -7.260291)
fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
***** Bone: Bird:Bird_L_tailFeathers
Parent: Bird:Bird_Pelvis
Local Translation fbx.KFbxVector4(0.253124, -0.978278, -1.236771, 1.000000)
Local Rotation fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)
Local Scale fbx.KFbxVector4(1.000000, 1.000000, 1.000000, 1.000000)
Global Matrix
fbx.KFbxVector4(0.721621, 0.000000, -0.692288, 3.098512)
fbx.KFbxVector4(-0.692288, 0.000000, -0.721621, -8.737417)
fbx.KFbxVector4(0.000000, 1.000000, 0.000000, -7.347859)
fbx.KFbxVector4(0.000000, 0.000000, 0.000000, 1.000000)


Everything up to and including Bird_Pelvis is fine. But with the tailFeathers bone, you'll notice that the matrix suddenly scales up around 11x. The local scaling is 0. In maya, the matrix looks like this:


select -r Bird:Bird_L_tailFeathers ;
xform -q -ws -matrix;
// Result: 0.0645943 0 0.0619687 0 0 0.0895128 0 0 -0.0619687 0 0.0645943 0 3.098512 -7.347859 8.737417 1 //

select -r Bird:Bird_Pelvis ;
xform -q -ws -matrix;
// Result: 0.0645943 0 0.0619687 0 0 0.0895128 0 0 -0.0619687 0 0.0645943 0 3.005521 -7.260291 8.80162 1 //

select -r Bird:Bird_Master ;
xform -q -ws -matrix;
// Result: 0.0895128 0 0 0 0 0.0895128 0 0 0 0 0.0895128 0 0 0 0 1 //


I've tried countless things, such as making sure the evaluator context is right (it is), checking the current frame times, etc. Reimporting the fbx file to maya yields the correct result, too. I just can't seem to get the right global matrix out of FBX for that node.

The GetNodeGlobalTransform just seems to completely ignore the scaling introduced by the BirdMaster node.

I've spent a hours googling for this, and trying practically every potential solution that came up, and I'm completely out of ideas at this point.

Cheers and thanks for reading,
Volker

Edit: I've added the maya output for Bird_Master and Pelvis for reference. As you can see, they match the FBX output, except for a Y<->Z conversion.
Edit2: I just realized I probably posted it in the wrong FBX forum, how can I fix that?
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

I've tried the ViewScene tool that comes with the FBX SDK, and got some interesting results.

This is the scene in Maya:

https://skitch.com/volcore/8xwt6/maya

and this is the scene with ViewScene:

https://skitch.com/volcore/8xw1w/viewscene

As you can see, ViewScene has the same issues as my script, so it seems to be a Maya exporter issue.

Any ideashow to fix that?
Message 3 of 5
Anonymous
in reply to: Anonymous

Can you tell us if your rig has any scaling compensation?
Message 4 of 5
Anonymous
in reply to: Anonymous

Hey Carlos,

yeah, scale compensation seems to be enabled:

https://skitch.com/volcore/8xs6q

What does it do? Can I just disable that?

Cheers,
Volker
Message 5 of 5
Anonymous
in reply to: Anonymous

Alright, I disabled it for all bones, and that did the trick.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report