Community
void ExtractVertexData(FbxMesh* pMesh)
{
int lVertexCount = pMesh->GetControlPointsCount();
FbxVector4* lControlPoints = pMesh->GetControlPoints();
for(int i=0; i < lVertexCount; i++)
{
FbxCluster* lCluster = gWorkingModel.getCluster(i);
FbxVector4 lVert = lControlPoints;
FbxVector4& lDstVertex = lControlPoints;
if(lCluster != NULL && true)
{
printf("VertIndx %i is attached to %s\n", i, lCluster->GetLink()->GetName());
FbxAMatrix lMeshGlobal;
lCluster->GetTransformMatrix(lMeshGlobal);
FbxAMatrix lMeshGeometry = GetGeometry(pMesh->GetNode());
lMeshGlobal *= lMeshGeometry;
lDstVertex = lMeshGlobal.MultT(lVert);
FbxAMatrix lBoneBindingMatrix;
lCluster->GetTransformLinkMatrix(lBoneBindingMatrix);
lDstVertex = lBoneBindingMatrix.Inverse().MultT(lDstVertex); // now it is in bone space
FbxNode* lBoneNode = lCluster->GetLink();
lDstVertex = lBoneNode->EvaluateGlobalTransform().MultT(lDstVertex);
printf("\tlMeshGlobal T\n", lMeshGlobal.GetT(), lMeshGlobal.GetT(), lMeshGlobal.GetT());
printf("\tlMeshGlobal S\n", lMeshGlobal.GetS(), lMeshGlobal.GetS(), lMeshGlobal.GetS());
printf("\lBoneBindingMatrix T\n", lBoneBindingMatrix.GetT(), lBoneBindingMatrix.GetT(), lBoneBindingMatrix.GetT());
printf("\lBoneBindingMatrix S\n", lBoneBindingMatrix.GetS(), lBoneBindingMatrix.GetS(), lBoneBindingMatrix.GetS());
printf("\lBoneBindingMatrix Inverse T\n", lBoneBindingMatrix.Inverse().GetT(), lBoneBindingMatrix.Inverse().GetT(), lBoneBindingMatrix.Inverse().GetT());
printf("\lBoneBindingMatrix Inverse S\n", lBoneBindingMatrix.Inverse().GetS(), lBoneBindingMatrix.Inverse().GetS(), lBoneBindingMatrix.Inverse().GetS());
}
gWorkingModel.addVertex( DogModel::fromFBXVector4(lDstVertex));
}
printf("%i Vertices loaded\n", gWorkingModel.getVertexCount());
}
FbxAMatrix lMeshGlobal;
lCluster->GetTransformMatrix(lMeshGlobal);
FbxAMatrix lMeshGeometry = GetGeometry(pMesh->GetNode());
lMeshGlobal *= lMeshGeometry;
lDstVertex = lMeshGlobal.MultT(lVert);
FbxAMatrix lBoneBindingMatrix;
lCluster->GetTransformLinkMatrix(lBoneBindingMatrix);
lDstVertex = lBoneBindingMatrix.Inverse().MultT(lDstVertex); // now it is in bone space
FbxNode* lBoneNode = lCluster->GetLink();
lDstVertex = lBoneNode->EvaluateGlobalTransform().MultT(lDstVertex);
FbxAMatrix lMeshGlobal;
lCluster->GetTransformMatrix(lMeshGlobal);
FbxAMatrix lMeshGeometry = GetGeometry(pMesh->GetNode());
lMeshGlobal *= lMeshGeometry;
lDstVertex = lMeshGlobal.MultT(lVert);
But the model was far to shrunken so i then proceeded to try changing it to bone space just to see if that gave me what i needed
FbxAMatrix lBoneBindingMatrix;
lCluster->GetTransformLinkMatrix(lBoneBindingMatrix);
lDstVertex = lBoneBindingMatrix.Inverse().MultT(lDstVertex); // now it is in bone space
and the scale problem was fixed by now the mesh was squished together, but the pieces that were squished together looked to be the right size, and in the right orientation.
I then proceeded just for the hell of it (even tho I knew multiplying a matrix by is inverse was just gonna cancle eachother out) trying to multiply it by its bone matrix to see if that worked since it was in bone space.
FbxNode* lBoneNode = lCluster->GetLink();
lDstVertex = lBoneNode->EvaluateGlobalTransform().MultT(lDstVertex);
but it went right back to the scaling issues.
Please help I have been splitting hairs and reading and going to training and still have not made the progress I wanted to, there is something that I have to be missing or somethign that I'm quite not getting because other wise i should of had my results by now.
Attached is a copy of the model Im using for testing purposes.
https://www.dropbox.com/s/teie2uxf3x72ijs/BoxPivot3.FBX
Can't find what you're looking for? Ask the community or share your knowledge.