I probably could bake them, but its a standard element of the COLLADA structure, Assimp should be able to handle this. Here's a peek at the source code for the ColladaHelper.h
http://projects.deve....h?rev=145#L567
/** A skeleton controller to deform a mesh with the use of joints */
struct Controller
{
// the URL of the mesh deformed by the controller.
std::string mMeshId;
// accessor URL of the joint names
std::string mJointNameSource;
///< The bind shape matrix, as array of floats. I'm not sure what this matrix actually describes, but it can't be ignored in all cases
float mBindShapeMatrix[16];
// accessor URL of the joint inverse bind matrices
std::string mJointOffsetMatrixSource;
// input channel: joint names.
InputChannel mWeightInputJoints;
// input channel: joint weights
InputChannel mWeightInputWeights;
// Number of weights per vertex.
std::vector<size_t> mWeightCounts;
// JointIndex-WeightIndex pairs for all vertices
std::vector< std::pair<size_t, size_t> > mWeights;
};
So it is at least acknowledged.
Here's from ColladaLoader.cpp
http://projects.deve...?rev=145&desc=1
// apply bind shape matrix to offset matrix
aiMatrix4x4 bindShapeMatrix;
bindShapeMatrix.a1 = pSrcController->mBindShapeMatrix[0];
bindShapeMatrix.a2 = pSrcController->mBindShapeMatrix[1];
bindShapeMatrix.a3 = pSrcController->mBindShapeMatrix[2];
bindShapeMatrix.a4 = pSrcController->mBindShapeMatrix[3];
bindShapeMatrix.b1 = pSrcController->mBindShapeMatrix[4];
bindShapeMatrix.b2 = pSrcController->mBindShapeMatrix[5];
bindShapeMatrix.b3 = pSrcController->mBindShapeMatrix[6];
bindShapeMatrix.b4 = pSrcController->mBindShapeMatrix[7];
bindShapeMatrix.c1 = pSrcController->mBindShapeMatrix[8];
bindShapeMatrix.c2 = pSrcController->mBindShapeMatrix[9];
bindShapeMatrix.c3 = pSrcController->mBindShapeMatrix[10];
bindShapeMatrix.c4 = pSrcController->mBindShapeMatrix[11];
bindShapeMatrix.d1 = pSrcController->mBindShapeMatrix[12];
bindShapeMatrix.d2 = pSrcController->mBindShapeMatrix[13];
bindShapeMatrix.d3 = pSrcController->mBindShapeMatrix[14];
bindShapeMatrix.d4 = pSrcController->mBindShapeMatrix[15];
bone->mOffsetMatrix *= bindShapeMatrix;
From this it would seem like the transform gets baked into the inverse bind matrix... and checking now... it seems that this is the case because the mOffsetMatrix is different for the same joint when comparing two sepearte meshes with unique bind shape matrices.
Hmm that would explain why the bone influences are defined seperately for each mesh, instead of one global skeleton.
This seems really inefficient, because now I need to store a seperate version of each bone for each mesh because of these unique inverse bind transforms...
Should I just store the inverse binds along with the mesh objects instead of inside the bones? Then for a given model, iterate over the skeleton, update the global transforms, then update the unique skinning matrices using the inverse binds stored in the mesh?
Edited by pondwater, 07 September 2012 - 12:32 PM.