|
Hi,
I encounter a problem when importing a basic scene exported from maya 2012.
The scene is composed as followed:
group1 (position 0, 2, 0)
camera1 (local position 0, 0, 9)
no rotations and no scaling applied.
It seems that the local position of the camera is wrong when using the EvaluateLocalTransform().
I used the OpenGL axis system. The result should be trivial.
Here is the code I used to dump the informations:
/*-------------------------------------------------------------------------*/
bool __fbxParseNode(KFbxNode *fbxNode);
/*-------------------------------------------------------------------------*/
bool fbxParseScene(KFbxScene *fbxScene) {
if(fbxScene == NULL)
{
return false;
}
/**/
KFbxAxisSystem sceneAxisSystem = fbxScene->GetGlobalSettings().GetAxisSystem()
KFbxSystemUnit sceneSystemUnit = fbxScene->GetGlobalSettings().GetSystemUnit();
KFbxAxisSystem engineAxisSystem(KFbxAxisSystem::OpenGL)
KFbxSystemUnit engineSystemUnit(KFbxSystemUnit::cm);
if(sceneSystemUnit != engineSystemUnit)
{
engineSystemUnit.ConvertScene(fbxScene);
}
if(sceneAxisSystem != engineAxisSystem)
{
engineAxisSystem.ConvertScene(fbxScene);
}
/**/
__fbxParseNode(fbxScene->GetRootNode());
return true; }
/*-------------------------------------------------------------------------*/
bool __fbxParseNode(KFbxNode *fbxNode) {
if(fbxNode == NULL)
{
return false;
}
/**/
KFbxVector4 vector;
KFbxXMatrix matrix;
printf(" Geometric Transformations: %s\n", fbxNode->GetName());
vector = fbxNode->EvaluateLocalTranslation();
printf(" Translation: %f %f %f\n\n", vector[0], vector[1], vector[2]);
vector = fbxNode->EvaluateLocalRotation();
printf(" Rotation: %f %f %f\n\n", vector[0], vector[1], vector[2]);
vector = fbxNode->EvaluateLocalScaling();
printf(" Scaling: %f %f %f\n\n", vector[0], vector[1], vector[2]);
/**/
matrix = fbxNode->EvaluateLocalTransform();
printf(" LocalMatrix: %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n\n",
matrix[0][0], matrix[0][1], matrix[0][2], matrix[0][3],
matrix[1][0], matrix[1][1], matrix[1][2], matrix[1][3],
matrix[2][0], matrix[2][1], matrix[2][2], matrix[2][3],
matrix[3][0], matrix[3][1], matrix[3][2], matrix[3][3]
);
matrix = fbxNode->EvaluateGlobalTransform();
printf(" GlobalMatrix: %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n"
" %f %f %f %f\n\n",
matrix[0][0], matrix[0][1], matrix[0][2], matrix[0][3],
matrix[1][0], matrix[1][1], matrix[1][2], matrix[1][3],
matrix[2][0], matrix[2][1], matrix[2][2], matrix[2][3],
matrix[3][0], matrix[3][1], matrix[3][2], matrix[3][3]
);
for(int i = 0; i < fbxNode->GetChildCount(); i++)
{
__fbxParseNode(fbxNode->GetChild(i));
}
return true; }
/*-------------------------------------------------------------------------*/
The result is as follow:
Geometric Transformations: RootNode
Translation: 0.000000 0.000000 0.000000
Rotation: 0.000000 0.000000 0.000000
Scaling: 1.000000 1.000000 1.000000
LocalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000
GlobalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 0.000000 1.000000
Geometric Transformations: group1
Translation: 0.000000 2.000000 0.000000
Rotation: 0.000000 0.000000 0.000000
Scaling: 1.000000 1.000000 1.000000
LocalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 -0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 2.000000 0.000000 1.000000
GlobalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 -0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 2.000000 0.000000 1.000000
Geometric Transformations: camera1
Translation: 0.000000 0.000000 9.000000
Rotation: 0.000000 0.000000 0.000000
Scaling: 1.000000 1.000000 1.000000
LocalMatrix: 0.000000 0.000000 -1.000000 0.000000
0.000000 1.000000 0.000000 0.000000
1.000000 0.000000 0.000000 0.000000
0.000000 0.000000 9.000000 1.000000
GlobalMatrix: 0.000000 -0.000000 -1.000000 0.000000
0.000000 1.000000 -0.000000 0.000000
1.000000 0.000000 0.000000 0.000000
0.000000 2.000000 9.000000 1.000000
The expected output should be the following:
Geometric Transformations: camera1
LocalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 0.000000 9.000000 1.000000
GlobalMatrix: 1.000000 0.000000 0.000000 0.000000
0.000000 1.000000 0.000000 0.000000
0.000000 0.000000 1.000000 0.000000
0.000000 2.000000 9.000000 1.000000
Can you tell me what is going on?
It is a real bug or have I done a mistake in the source code?
|