Area :: Header
3ds Max 2015 Extension 1 is here

With new tools to power your pipeline
Discussion Groups

FBX SDK

Reply
Contributor
shaunsouthern
Posts: 16
Registered: ‎04-19-2010

Node connected to Bone problem

164 Views, 6 Replies
04-02-2011 02:23 AM
Hi

Our FBX parser seems to work fine with rigid meshes, and bones, but seems to have a problem when a mesh is attached as a child of a bone.

We have a simpoe object with a bone with seven cubes attached to it all as sibling children. They should be arranged in a 3d cross shape around the centre cube, such that the centre cube is at 0,0,0, and there are cubes in each direction along X Y and Z at distances 100 units away.

When we use KFbxXMatrix matTransform = pNode->GetGlobalFromDefault() to read the matrices of the cubes, we indeed get seven cubes based around a middle one, and they all so seem to be facing the same direction, also they are 100 units away from the centre, but they are all offset at different angles, not at right angles from each other. I've tracked the problem dpown the the results coming from the above call.

The angle of the cubes, while consistent with each other, doesnt seem to be the same as the bone to which they are connected (though this may be down to how they are attached)

What coudl possibly be goign wrong ? Am I missing a call to initialise the matrices correctly ? Am I using the wrong call ? Could it be a pivot or offset problem, or another matrix I'm not taking into account ?

We just use this to initialise and load the scene

InitializeSdkObjects(lSdkManager, pFbxScene);
lResult = LoadScene(lSdkManager, pFbxScene, name);


An image is attached of what the cubes look like when rendered. They shoudl all be attached squarely along their faces...



Thanks for your help

Shaun Southern

Please use plain text.
Distinguished Contributor
Numerator
Posts: 665
Registered: ‎02-19-2008

Re: Node connected to Bone problem

04-02-2011 01:53 PM in reply to: shaunsouthern
Can you post the FBX file? Use .zip
Please use plain text.
Contributor
shaunsouthern
Posts: 16
Registered: ‎04-19-2010

Re: Node connected to Bone problem

04-03-2011 12:09 AM in reply to: shaunsouthern
Sure, here you go. There may well be something odd about the setup... This file has been exported from Max. I'm not sure if this fbx file loads back into Max ok, I cant test that until tomorrow...

parent_test_mesh.zip

Please use plain text.
Distinguished Contributor
Numerator
Posts: 665
Registered: ‎02-19-2008

Re: Node connected to Bone problem

04-03-2011 06:20 PM in reply to: shaunsouthern
Are you taking into account the frame hierarchy? It looks like a straight forward unskinned bone dependency with each bone controlling 7 boxes.
Please use plain text.
Contributor
shaunsouthern
Posts: 16
Registered: ‎04-19-2010

Re: Node connected to Bone problem

04-04-2011 01:38 AM in reply to: shaunsouthern
Hi

We loaded the fbx file back into Max, and its fine.

Yes, the file shoudl be three bones, each with seven boxes attached to it. That was our problem, meshes attached as children of bones.

Somethign is very wrong about the angles/positioning of the boxes, as you can see from the picture - they're not even at right angles offsets to each other..


So what do you mean by taking into account the "frame heirarchy" ? Do I need to call a fucntion after loading the fbx to sort this out ?

I just use GetGlobalFromDefault to read each object's global matrix - or so I thought....


Thanks again

Shaun
Please use plain text.
Distinguished Contributor
viviane.rochon
Posts: 396
Registered: ‎07-11-2007

Re: Node connected to Bone problem

04-04-2011 09:05 AM in reply to: shaunsouthern
Hi Shaun,

Which version of the FBX SDK are you using?
In 2011.3.1, you should use lScene->GetEvaluator()->GetNodeGlobalTransform(lNode); to get the global transform of a node.

Viviane
Please use plain text.
Contributor
shaunsouthern
Posts: 16
Registered: ‎04-19-2010

Re: Node connected to Bone problem

04-05-2011 01:24 AM in reply to: shaunsouthern
OK, thanks again for the replies. I changed the function and it was still the same. I couldn't understand why the data coming out was wrong as it came straight from that function, then was output to our file.

Or so I thought.....

In the output matrix function, there was code to flip the matrices from Max's Z-UP format to Y up. It had worked with everythign we'd done so far, however.... one of the matrix multiplies was the wrong way round... which hadn't mattered because most of our objects were simple enough and lined up along Z. So unit matrix * rotate Z to Y worked either way. However, as soon as one of the matrices was offset at an angle, which the bones were, there was a problem. The cubes attached to the bones looked in line, but they were cubes and actually roated 90 degrees in X and Z to the bone. So becasue the matrix multiplies were the wrong way round, all hell broke loose.

Thanks again for everyone's help, it only went to prove that the problem wasn't in the FBX code or the model, which led me to look a little deeper and try something I wouldn't have bothered with otherwise....


Until the next time !


Shaun Southern
Please use plain text.