Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Lantz

Skinned meshes

This topic is 5864 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 need some help with skinned meshes. Could anyone explain the basics? I know I need a couple of (animated) matrices and vertex weights, but how should it be put together? Should there be some kind of hiearchy? And there should be some kind of matrix interpolation right? Any information you could provide would be great. Regards, Lantz

Share this post


Link to post
Share on other sites
Advertisement
the idea is a fairly simple extension of hierarchical animation. With straight hierarchical animation, each mesh that is assigned to a bone is affected only by the movement of that bone. You could extend the idea to say that all vertices in that mesh are affected by the transformation of that specific joint. Now for hierarchical animation, the mesh that is attached to any given bone is usually defined in the local space of that bone, ie, the bones axis forms the `origin` of the mesh so all vertices etc are defined from there.

Skinning (at the most simple level) basically says that each vertex is transformed by one joint; this is rigid skinning btw. When multiple bones are used a mesh can be affected by different bones in different locations to give the skinning effect. The only real problem with this is that you have to know the co-ordinates of the vertex defined in local space with respect to the joint it''s attached to. (you might want to ensure that the bind pose of your models always has the root node centered at the origin with all of the joints axis aligned. The only reason is that the local space of vertex1 can be defined as (vertex1 - jointPosition); having models set up any differently will require some inverse transforms to determine the local space co-ords.)

Once you have the vertex in local space, animate the hierarchy as you would normally and perform the following operation for each vertex:

currentVertexPos = WorldSpaceJointTransformMatrix * LocalSpaceVertexCoord


There are certain situations where you want more than one bone affecting a particular vertex; say for example you wanted a vertex at the knee to have an equal influence from the shin bone and the thigh bone, you could figure out the vertex when influenced by both bones, and then average them. This is where the concepts of skin weights come from, essentually the case above would look like :

currentVertexPos = 0.5*WorldSpaceJointTransformMatrix1 * LocalSpaceVertexCoord1 + 0.5*WorldSpaceJointTransformMatrix2 * LocalSpaceVertexCoord2;

here we are using 0.5 as the vertex weights of both bones to ensure that we will have an equal influence between both. Now, we could basically add as many bones as we want and average them in a similar way to add influences to the vertices movement. The only restriction is that the weights for any given vertex must add up to 1.

Share this post


Link to post
Share on other sites
So, if I understood correctly, what I need is first a matrix for every joint to translate the vertices into the joints coordinate space, and then the regular matrices for the animation/transformation stuff. Have I got it right?
And a follow up question, does the joint matrices need to be transformed by parent bones or something?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!