How to take a combined matrix back to bone space?

Started by
5 comments, last by lucky6969b 7 years, 3 months ago

If I have calculated the combined matrix for every bone,
How do I convert it back into local matrices in bone space.
Do I just multiply the combined matrix with the inverse of the offset matrix of the bone?
I can't get it to work?
Thanks
Jack

Advertisement
Are you trying to convert between two different bones? If so: inverse(combinedMatrix2) * combinedMatrix1

If you're trying to get the local matrix of a bone in the same bone's space, that's pointless: It's always going to be the identity matrix.

(edit: checked multiplication order and fixed)

Hello,

What I am playing with is after my bvh component has finished calculating all the bones combined matrices,

I actually want to blend them with other stuff like the IK and rest of the animations.... shaking hands,

sitting down whatever, I actually want to render the bvh data into the animation controller, so the mixing can be realized, but the bvh component is actually outputting combined matrix, my initial project was based on the bvh rendering directly into the rendering pipeline, Now some change is needed.

Thanks

Jack

OK, I solved it

Actually, after resolving the combined matrix from the animation controller

I just add on to bvh

bvhMat += matCombined;

Then IK

Thanks

Jack

I am wondering what this does?
What do you mean by "convert between two different bones"?
Do I move the first bone space to another, so that two bone spaces are in the same
space?


inverse(combinedMatrix2) * combinedMatrix1

I am wondering what this does?
What do you mean by "convert between two different bones"?
Do I move the first bone space to another, so that two bone spaces are in the same
space?

inverse(combinedMatrix2) * combinedMatrix1


That's for making a matrix representing bone1's combined transform, but in bone2's local space instead of whatever space the combined transforms are in (world space?).

I don't know if you need that or not. I'm confused by your posts :)

Hello,
From the pseudocode underneath,
does it mean, the frame.ToParent is retrieved from the asset file.
Then I multiply with the parent's transformation matrix
to get frame.ToRoot?
Then I multiply the mesh offset matrix with the inverse of this frame.ToRoot Matrix?
Thanks
Jack

function CalcToRootMatrix( Frame frame, Matrix parentMatrix )
{
    // transform from frame-space to root-frame-space through the parent's ToRoot matrix
    frame.ToRoot = frame.ToParent * parentMatrix;

    for each Child in frame: CalcToRootMatrix( Child, frame.ToRoot );
}

// Note: MeshFrame.ToRoot is the transform for moving the mesh into root-frame space.
function CalculateOffsetMatrix( Index boneIndex )
{
    string boneName = SkinInfo.GetBoneName( boneIndex );
    Frame boneFrame = FindFrame( root_frame, boneName );
    // error check for boneFrame == NULL if desired
    offsetMatrix[ boneIndex ] = MeshFrame.ToRoot * MatrixInverse( boneFrame.ToRoot );
}

BTW, if I want to take the combined matrix to transformation matrix.

That is the matrix that has an offset to the parent and some rotation elements around the root?

Do I multiply the combined matrix with the inverse of the offset matrix? or with the frame.ToRoot

matrix?

This topic is closed to new replies.

Advertisement