Hello,
I am trying to import data from fbx mesh file. I stacked with transformations. There are 2 levels of transformations for geometry in FXB, node and geometry, usually it is only first one, second transform applies on export for positions normal and other 3D data. I have two tested models without skinning. In first one geometry transform is identity, second one has both transforms.
The second case is most common in 3DS Max, but I getting correct look for second model if I don't use node transform at all when the first one needs it!!! And it is in one mesh format and I can't understand why.
[attachment=32086:ship1.jpg]
This is look when I doing geometry transform only
FbxAMatrix
mGeometryTransform = GetGeometry(pFBXNode);
// transform it to LH if
needed
if
(m_bOptionConvertToLH)
{
FbxVector4
Translation = mGeometryTransform.GetT();
FbxVector4
Rotation = mGeometryTransform.GetR();
Translation.Set(Translation.mData[0],
Translation.mData[2], Translation.mData[1]);
mGeometryTransform.SetT(Translation);
}
m_mTransformGeometry =
GetAFMatrixFromFBX(mGeometryTransform);
In vertex
buffer:
iControlPoint =
pFBXMesh->GetPolygonVertex(i,
0);
Point =
pFBXMesh->GetControlPointAt(iControlPoint);
pVertexes->x =
static_cast<float>(Point.mData[0]);
pVertexes->y =
static_cast<float>(Point.mData[1]);
pVertexes->z =
static_cast<float>(Point.mData[2]);
//
node geometry
transform
AFVector3TransformCoords(pVertexes, pVertexes,
&m_mTransformGeometry);
And this when I add Node Transform
[attachment=32087:ship2.jpg]
FbxVector4 Translation =
pFBXNode->LclTranslation;
FbxVector4 Rotation =
pFBXNode->LclRotation;
FbxVector4 Scaling =
pFBXNode->LclScaling;
FbxAMatrix
Transform;
Transform.SetTRS(Translation, Rotation,
Scaling);
pMeshFrame->m_m4x4Transform =
GetAFMatrixFromFBX(Transform);
To get World Transform I making multiplication for hierarchy:
AFMatrixMultiply(&spSceneObject->m_mWorld,
&spSceneObject->m_mLocal,
spSceneObject->GetParent()->GetMatrixWorld());
m_mLocal is a m_m4x4Transform transform. I can't use only Geometry Transform or all cases. Any ideas what is wrong here?
P.S. Sorry for alignment, can't make it good)