Sign in to follow this  

What is the OffsetMatrix for skinned meshes?

This topic is 4302 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

Howdy, I am trying to understand how to calculate the OffsetMatrix that gets put into the SkinInfo interface. I am taking the tiny_4anim file and trying to go backwards, so I can edit the frame hierarchy. I will render Tiny as a simple mesh (without the skinning) and draw spheres where the bones are. I assumed that the OffsetMatrix is the inverse of the one that represents the bone's transformation from the world center. So, I would just use the inverse of the OffsetMatrix as the world matrix for drawing each bone. When rendering Tiny as a skinned mesh, I found that I can use the ToRootMatrix (which is also called the CombinedMatrix in some tutorials and is the concatenation of all the parent Transformation matrices for that bone) as the world matrix for drawing the spheres correctly. However, I don't have the ToRootMatrix yet, since I am in the process of placing and editing the bones. I ended up moving the OffsetMatrix for each bone from the SkinInfo interface into each of my D3DXFRAME_EX structures, and I can use the inverse/transpose of it to place the spheres correctly. But I really need to know how I would calculate the OffsetMatrix for meshes I am building and skinning from scratch. And when I tried to set it to the inverse/transpose of the TooRootMatrix the whole display turned blue (the color of the bones). Any ideas? Thanks. [Edited by - DXnut on March 1, 2006 11:11:08 PM]

Share this post


Link to post
Share on other sites
No one know this? [disturbed] I know it something to do with the mesh's bind space, but I have no idea what bind space is (or how it differs from a mesh's local space). [totally]

I am really stuck. [looksaround]

Share this post


Link to post
Share on other sites
I don't know the terminology you're using, and I know if my terminology is not really in general use, but here goes:

Reference pose - The pose the model was exported in.

Calculate the reference pose matrix like all other bone matrix calculations. Local scale, rotation and translation build a local reference pose matrix. A cumulative reference pose matrix is found when a bone's local matrix is multiplied by the parent bone's cumulative matrix. If there is no parent, the cumulative matrix is the same as the local matrix. The main thing you want to store at the end of all this, is the inverse of the cumulative reference pose matrix of each bone.

When animating, you'll build a current pose as a set of local transforms, and then multiply by parent bones to get cumulative transforms.

Your final matrix to use for each bone will be the "inverse cumulative reference pose" * "cumulative current pose".

The inverse reference pose matrix moves the vertices from their exported pose to be relative to the bone. The current pose will move it from a point relative to the bone, back into object space. If you multiply your world transform in as the parent of bone 0, you don't need to apply a seperate world transform after calculating bones.

Share this post


Link to post
Share on other sites
Thanks. You pretty much stated, with different terms, what I know now.

The root bone is the "local matrix", and is set to the identity matrix. Each bone in the hierarchy has its own to-parent matrix, and the ToRootMatrix I talked about is the cumulative matrix that takes that bone back to the root.

And yes, the final matrix to use is OffSetMatrix * ToRootMatrix.

You seem to be saying that the OffsetMatrix is the inverse of the ToRootMatrix for that bone. However, I have taken all of the matrices used in the Tiny.x mesh and tried to perform various calculations on them to see if I can calculate a matrix that is equivalent to the OffSet (inverse matrix) that exists for that bone. I can't even come close.

I have tried getting the inverse, inverse-transpose, and transpose-inverse of the TooRootMatrix, and the bone's own to-parent matrix. Nothing works.

Thanks though.

Share this post


Link to post
Share on other sites

This topic is 4302 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this