Jump to content
  • Advertisement
Sign in to follow this  

Understanding Skeletal Animation

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

I am in the process of creating a skeletal animation engine for a game that a couple of us are hoping to finish (eventually), but I seem to have run into some conceptual issues. Once I read some background info on how basic skeletal animation was done, I began looking at formats I liked. I found the Quake III .md5 format and decided to look into it since it seem to be what I wanted. I noticed that the weight system is different than matrix palette skinning. Instead each weight has a vertex's position stored relative to each bone that contributes to it. This got me thinking about how matrix palette skinning structure works: How can you apply a bone transformation to a vertex v' = v*m1*w1+v*m2+w2 where m(n) is the contributing bone matrix, and w(n) is the corresponding weight. This doesn't seem valid because the vertex is in local space relative to a single bone, so when you apply a different matrix, it would transform the vertex that is in a different space. So how does this work correctly or is it just a different way of doing it resulting in a different look? Or am I missing something. In addition, how does one do .md5 animation efficiently if you have multiple coordinates for each vertex? Do you send an array of say, 4 vertex positions (for 4 bones) to your vertex shader to do the calculations and leave some vertexes/weights zero if they don't contribute? This seems like a waste of space compared to the other method because instead of storing dead weight numbers you have to store dead vertexes as well.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by StormArmageddon
This got me thinking about how matrix palette skinning structure works: How can you apply a bone transformation to a vertex v' = v*m1*w1+v*m2+w2 where m(n) is the contributing bone matrix, and w(n) is the corresponding weight. This doesn't seem valid because the vertex is in local space relative to a single bone, so when you apply a different matrix, it would transform the vertex that is in a different space. So how does this work correctly or is it just a different way of doing it resulting in a different look? Or am I missing something.

In this case, the vertex is not in a bone's local space, it is in model space. That is the reason for the "bind" pose. The bind pose determines the vertex's untransformed position. Before applying a bone's contribution you still must transform the vertex into the bone's space. That is done by transforming the vertex by the inverse of the bone's matrix in the bind pose. So the actual equation is v' = vB1-1M1w1 + vB2-1M2w2 + ..., where Bi-1 is the inverse of bone's matrix in the bind pose, Mi is the bone's animated value and wi is the weight for that bone.

However, a good optimization to premultiply Bi-1Mi once per frame so you don't have to do it for every vertex.

Share this post


Link to post
Share on other sites
Thanks, that clears up some of the stuff I have read, though it does bother me that some sources neglect to mention the inverse step. And I guess it also explains the MD5 format: instead of calculating the bind pose and using the inverse of the bind pose matrix, they just calculate v*B_inverse.

So does anyone have any suggestion as to which method is better? You need more matrix multiplication using the matrix palette method, but MD5 needs more storage in the vertex buffer.

Share this post


Link to post
Share on other sites
Quote:
Original post by PfhorSlayer
I did MD5 skinning on the GPU, and even wrote something up about it!

Check out this!


I knew that, I was just pointing out that if you want to do skinning on the GPU I'm sure there are formats that are easier to use than MD5.

Share this post


Link to post
Share on other sites
Thanks for the link, though it seems that you just convert the MD5 to a standard matrix palette skinning method (with batching bone sets of course). This means I can write one class to handle both kinds, which is always good =).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!