The worldspace bindpose matrix for a bone is the the world space matrix for that bone itself in blender. If you only have local space matrices for the bones in blender, then you have to work up the tree from the root node to generate them.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.
That animationTransform matrix is the local-space matrix generated by a single frame of animation, relative to the space of the parent.
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?
The parent animation transforms come into play when generating the world transform for the parent, as its the world transform of the parent you need to pass down to the children in the tree.
The armatureMatrix in your case might be a pre-concatenation matrix for the animation transform?
I've never needed anything beyond: parentBoneWorldspace * childAnimatedLocalspace * inverseBindPose
animationTransform is a local space matrix. When your animationTransforms are converted to world space by walking the tree and concatenating the transforms, the resulting matricies should look like the boneMatrix values. Unless your boneMatrix (and corresponding skinMatrix) are in a different coordinate space.
I know thatMatrix4f.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?
I suggest writing some debug rendering code that draws the matrices as axis-markers connected by lines showing the hierarchy.