I'm trying to write a parser for FBX files to my custom model format that can be used in my game engine but I'm currently stuck on extracting the matrices needed for each bone. I think I might be lost in the theory of skinning as well...
I've managed to extract the bone hierarchy of a mesh and attach the weights and indexes of deformation-clusters to my vertices. Now I need to extract the (two?) matrices I need to do skinning in my engine.
Basically, in my format I would like it too look something like this:
//BoneID
//ParentBoneID
//Matrix1
//Matrix2
Now, to the matrices... Am I right to assume that at least one of them should be the "Bind pose-matrix", ie the default position of my skeleton? How do I extract this from FBX? Is this matrix uniform for the entire mesh?
As for the second one, I don't really know, I've tried looking at the ViewScene and ImportScene examples but I don't get it. I read something about "Local space matrix", I'm guessing this is the individual position, rotation and scale of each bone?
Any help or suggestions is appreciated, I'm at a loss right now, probably from staring myself blind at this. Almost at the point of abandoning FBX in favor of COLLADA.
Edit1: The engine doesn't have drawing capabilites yet as I wanted to get this done before moving on. I found an example that I think I understand, perhaps someone here can confirm if it's correct or not.
//TEST CODE
//This lFbxLinkMatrix is the skeleton's transform when the binding happened.
//It is the same as the matrix in bindpose if the bindpose is complete.
// Multiply lClusterGlobalInitPosition by Geometric Transformation
FbxAMatrix clusterGlobalInitPosition;
cluster->GetTransformLinkMatrix(clusterGlobalInitPosition);
FbxAMatrix clusterGeometry = GetGeometry(cluster->GetLink());
clusterGlobalInitPosition *= clusterGeometry;