Sign in to follow this  
stephanus

Skeletal Animation

Recommended Posts

Hi all, I would like to as about skeletal animation. I've searched in this forum and internet, but it seems I still dont get how skeletal animation is done. Can anyone explain all the coordinate system/spaces+matrices involved that transforms a bone from its local space to the world space? Including the inverse bind pose matrix, this one I really dont have any idea... I'm a beginner in skeletal animation, hope you can help me. Thanks! regards, tep

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
hi,

years ago i made a ogl vertex shader about that and its a little hard to remember, but i'll try:

for example, the upper leg has a 3x3 orientation and a center vertex.
xform the lower leg (child) center vertex with that information.
rotate the lower leg orintation as you want (animation data), the multiply it with upper leg (parent) matrix,
so parent orientation affects child.
repeat ecursively: lower leg gets parent, foot gets child...

now all bone positions and orientations are known.
if you woldn't use vertex weighting, you could predefine a vertex in the space of its bone,
and xform it by bone orn + pos. - finished.

if you want vertex weighting, it gets a little harder (and here i will maybe tell you something wrong, others will correct :)
define vertices in model space.
for each bone build an matrix that xforms modelspace to bonespace. (or was it bonespace to modelspace / inverse?)
multiply this matrix with the animated bone matrix from above.
xform a vertex by all affecting matrices and sum the results in relation to the weights (sum of weights must be 1).
finished.

hope that helps,
best to try out without ogl or dx first.


Share this post


Link to post
Share on other sites
There are basically two parts to this, to do with the skeleton hierarchy itself and then skinning an attached mesh.

Each bone in the skeleton generally stores (or calculates from position/rotation/scale) a local transform, which is the transform of that bone relative to its parent bone. For the root bone(s), which are usually considered to be "attached" to the entity that owns the skeleton and have no parent, these transforms are relative to the entity. To get the world-space transform for any particular bone, all you need to do then is concatenate the bones' local transforms in hierarchy order from the root to the bone concerned.

The bind pose matrices come up when skinning a mesh attached to a skeleton. When the mesh is originally modelled and rigged, it will be in a certain pose (often a variant on the so-called 'Da Vinci pose'). The bind matrix for each bone is its concatenated transform (either object space or world space, depending how you want to do it) in this bind pose, and correspondingly the inverse bind matrix is the inverse of this matrix. When skinning a vertex, the original vertex position in the bind pose is transformed into local bone space before weighting, which requires multiplying by the inverse bind matrix for the bone, then transformed again by the current world matrix of the bone. This is typically optimised by computing the product of the inverse bind pose matrix and the current world matrix for each bone once before skinning, rather than for each vert. Obviously you also typically weight the contribution of several bones for soft skinning.

Hope this helps a bit!

Share this post


Link to post
Share on other sites
Hi d00fus,
Thanks for replying, your posting has helped me to understand skeletal animation clearer. I just want to reassert whether my understanding is correct :).

So, for each bone Bi, there is a matrix called bind matrix Mi, which is a concatenation of matrix from root bone to the current bone Bi. This is only true in the initial pose (Da Vinci pose). Hence, if I am in some other pose and I want to go to the local bone space, I need to multiply it with "a matrix that transforms current pose to da vinci pose" and "inverse bind matrix for that bone". Am I correct to say that?

Thanks a lot!

regards,
tep

Share this post


Link to post
Share on other sites
If I understand what you're asking, you want to transform a point in world space into the local space of a bone in an arbitrary pose? If that's the case, you just need to transform the point by the inverse world matrix of the bone in the current pose. There's no need to go via the bind pose although the result should be the same (floating point error aside).

Share this post


Link to post
Share on other sites
I'm not sure I agree - this is simply animation-driven forward kinematics. The OP isn't (or hasn't said they are) trying to position (a subset of) the skeleton based on a desired end-effector position?

Share this post


Link to post
Share on other sites

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