
Advertisement
This topic is 2110 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.
If you intended to correct an error in the post then please contact us.
Recommended Posts
Digitalfragment 1505
Export the inverse of the worldspace bind pose for each joint.
Is the worldspace bind pose the same as the bind pose used to transform the vertices to get the "posttransformed 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.
[/quote]
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.
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?
That animationTransform matrix is the localspace matrix generated by a single frame of animation, relative to the space of the parent.
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 preconcatenation matrix for the animation transform?
I've never needed anything beyond: parentBoneWorldspace * childAnimatedLocalspace * inverseBindPose
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?
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 suggest writing some debug rendering code that draws the matrices as axismarkers connected by lines showing the hierarchy.
1
bobhowdy 114
I'm still not getting this
Lets try with some matrices. This is what I have to work with for the root bone:
root
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
model
0.5 0.0 0.0 0.0
0.0 0.5 0.0 0.0
0.0 0.0 2.0 2.0
0.0 0.0 0.0 1.0
armature
2.0 0.0 0.0 0.0
0.0 2.0 0.0 0.0
0.0 0.0 0.5 1.0
0.0 0.0 0.0 1.0
rootbone
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
skin
0.5 0.0 0.0 0.0
0.0 0.0 2.0 2.0
0.0 0.5 0.0 0.0
0.0 0.0 0.0 1.0
animation
0.0 1.0 0.0 0.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
I know that root*model*armature*rootBone*skin results in the identity matrix. But I don't see anything here that would turn my animation matrix back into the identity matrix. It seems like it should be turned back into the identity matrix or the bind pose matrix.
My model is sort of a test model. It's the shape of two bones, the two bones that animate it. So I can see where the bones are easily. Edited by bobhowdy
Lets try with some matrices. This is what I have to work with for the root bone:
root
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
model
0.5 0.0 0.0 0.0
0.0 0.5 0.0 0.0
0.0 0.0 2.0 2.0
0.0 0.0 0.0 1.0
armature
2.0 0.0 0.0 0.0
0.0 2.0 0.0 0.0
0.0 0.0 0.5 1.0
0.0 0.0 0.0 1.0
rootbone
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 1.0 0.0 0.0
0.0 0.0 0.0 1.0
skin
0.5 0.0 0.0 0.0
0.0 0.0 2.0 2.0
0.0 0.5 0.0 0.0
0.0 0.0 0.0 1.0
animation
0.0 1.0 0.0 0.0
1.0 0.0 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0
I know that root*model*armature*rootBone*skin results in the identity matrix. But I don't see anything here that would turn my animation matrix back into the identity matrix. It seems like it should be turned back into the identity matrix or the bind pose matrix.
My model is sort of a test model. It's the shape of two bones, the two bones that animate it. So I can see where the bones are easily. Edited by bobhowdy
0
bobhowdy 114
Figured it out. The animation matrix was being calculated wrong.
0
Sign in to follow this
Followers
0

Advertisement
Share this post
Link to post
Share on other sites