What is the OffsetMatrix for skinned meshes?

Started by
3 comments, last by Quaid Tseng 18 years, 1 month ago
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]
--------------------------Most of what I know came from Frank D. Luna's DirectX books
Advertisement
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]
--------------------------Most of what I know came from Frank D. Luna's DirectX books
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.
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.
--------------------------Most of what I know came from Frank D. Luna's DirectX books
There's an article may help..

http://www.gamedev.net/reference/articles/article2221.asp

This topic is closed to new replies.

Advertisement