# How to take a combined matrix back to bone space?

This topic is 652 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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

##### Share on other sites
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) Edited by Nypyren

##### Share on other sites

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

##### Share on other sites

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

##### Share on other sites

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
Edited by lucky6969b

##### Share on other sites

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 :) Edited by Nypyren

##### Share on other sites

Hello,
From the pseudocode underneath,
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?

Edited by lucky6969b

1. 1
Rutin
29
2. 2
3. 3
4. 4
5. 5

• 13
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632959
• Total Posts
3009458
• ### Who's Online (See full list)

There are no registered users currently online

×