I'm not sure why you have a seperate "skinMatrix" and "transformMatrix" being applied to the animation:
The .x file has a skinWeights section, in that it has a matrix, that's the skinMatrix I'm referring to. The transformMatrix is where I'm storing the result of all the matrix operations.
I'm doing that. If I set my bone matrices to identity, I get the model as it looks in Blender.
Export your vertex data post-transformed, so that the model looks correct when skinned with identity matricies.
Is the worldspace bind pose the same as the bind pose used to transform the vertices to get the "post-transformed vertex data"? i.e. The matrix obtained by rootMatrix*modelMatrix? If so the bind pose is the same for each joint... so I don't understand.
Export the inverse of the worldspace bind pose for each joint.
So you're saying the animation matrix should be created like the following?
Matrix4f animationTransform = new Quaternion(rotation).toMatrix(); animationTransform.m00 *= scale.x; animationTransform.m01 *= scale.x; animationTransform.m02 *= scale.x; animationTransform.m10 *= scale.y; animationTransform.m11 *= scale.y; animationTransform.m12 *= scale.y; animationTransform.m20 *= scale.z; animationTransform.m21 *= scale.z; animationTransform.m22 *= scale.z; animationTransform.m30 = position.x; animationTransform.m31 = position.y; animationTransform.m32 = position.z;
Where does the armatureMatrix and parent animation transforms come into play?
I know that
Matrix4f.mul(transformMatrix, boneMatrix, transformMatrix); Matrix4f.mul(transformMatrix, skinMatrix, transformMatrix);
Results in the identity matrix. But if I multiply in the animationTransform from above, things get wonky. I made an animation that's just the bind pose. But the animationTransform is not the identity matrix when the model is in the bind pose, so what's the deal?