Jump to content
  • Advertisement

Archived

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

Reverse_Gecko

Skeleton > Vertex influences?

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

Hey! I''m working on a skeletal animation system for my game (http://capturetf.sourceforge.net/) and I''ve got a question. So I have the bones animated properly, but I''m trying to put the character mesh over it. Each vertex has an influence value for each bone near it. Some have 100% influence from one bone, meaning they move with that bone completely. However I do not know what do do at say a joint (like a knee) where the vertex are influenced by multiple bones. How do other engine handle that? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
You want to use something called indexed vertex blending, where your vertex structure contains up to 3 or 4 index values into a matrix palette. So each vertex can be affected by 3 or 4 bones (since each bone is represented by a matrix).

If you''re using DirectX you can use the inbuilt indexed vertex blending system (max 256 bones per mesh), or use Vertex Shaders. If using vertex shaders then you are limited to the number of matricies you can fit into the constant registers (about 16 or something - so only 16 bones per mesh).

Hope I havn''t confused anyone.

Jim

Share this post


Link to post
Share on other sites
The easiest and good-looking way is to use the blend weights straight; take the weight of bone A, multiply the bone A-transformed vertex position by that, take the weight of bone B, multiply the bone B transformed vertex position by that, add the two vertex positions. If there''s a better-looking way, I certainly haven''t seen it used.

I assume, as you''re not asking, that you know how to get the 100%-effect vertices for any single bone. Just repeat the process for each affecting bone, multiply each by its respective weight, and sum them together.

Against TCPA!

I am a signature virus. Please add me to your signature so that I may multiply.

Share this post


Link to post
Share on other sites
For each vertex, find the number of bones effecting it. Initialize a temporary vertex to 0,0,0. Calculate the transformed vertex, and then add it to the temporary vertex, scaled by the weight by which the vertex is influenced by the bone. Continue until all bones for that vertex have been accumulated into your temporary vertex. Store that temporary vertex into your output vertex buffer. Move onto the next vertex.

That''s a simple way of doing it in software. Since the bone influences are just vector directions (like normals) and not points, you can scale the offset vector and add it to the output point.

When working in vertex shader, the concept is the same, but you are limited by the number of constant registers. This is because the matrix for each bone has to be sent to the vertex shader. As the previous poster noted, there is a finite amount of room in the shader constant registers, but in practice this isn''t usually a problem - simply have your artist break your mesh up into submeshes: the upper body and the lower body, or the arms and the torso and the lower body. The limit to the constant registers is only within one submesh, not the whole submesh. Simply load the correct matrices between each submesh.



Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Reverse_Gecko
Hey!

I''m working on a skeletal animation system for my game (http://capturetf.sourceforge.net/) and I''ve got a question.

So I have the bones animated properly, but I''m trying to put the character mesh over it. Each vertex has an influence value for each bone near it. Some have 100% influence from one bone, meaning they move with that bone completely. However I do not know what do do at say a joint (like a knee) where the vertex are influenced by multiple bones. How do other engine handle that?

Thanks.



psVertexToDraw = VertexInBoneSpace*BoneTM1*vWeight1 + VertexInBoneSpace*BoneTM2*vWeight2 +......

simple as that.

Share this post


Link to post
Share on other sites
quote:
Original post by Anonymous Poster
quote:
Original post by Reverse_Gecko
Hey!

I''m working on a skeletal animation system for my game (http://capturetf.sourceforge.net/) and I''ve got a question.

So I have the bones animated properly, but I''m trying to put the character mesh over it. Each vertex has an influence value for each bone near it. Some have 100% influence from one bone, meaning they move with that bone completely. However I do not know what do do at say a joint (like a knee) where the vertex are influenced by multiple bones. How do other engine handle that?

Thanks.



psVertexToDraw = VertexInBoneSpace*BoneTM1*vWeight1 + VertexInBoneSpace*BoneTM2*vWeight2 +......

simple as that.




oh btw BoneTM1 is offcourse the transformation matrix of the bone
for the given frame after hiarichal affections etc.

stian (forgot loggin in there above)

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!