Jump to content
  • Advertisement
Sign in to follow this  
THACO

skinning and with multiple weights

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

Ok I have a mesh with bones (not a hierarchy) and each vertex could be influenced by 4 different bones. The bones are represented by matrices to move the vertex to the cumulative bone space. Currently I have the vertex in world space, Step 1. I multiply the vertex by the inverse matrix at frame 0 (to move to bone space) for each of the bones that has influence on it. (i now possible have 4 unique vertices) Step 2. I multiple each of the new verticies by the matrix at frame X (somewhere in the middle of an animation) for each of the bones that has influence on it. Step 3. I multiple each of the vertices compnonents (x,y,z) by the bones influence percentage Step 4. I add all of the components from each vertex together Step 5. I return the new vertex Now currently it seems to work great but I want to make it a little more efficient I want to move the multiplication by the inverse offline. When I try that, I perform Step 1, then Step 3,4,5. Then back in my program I perform steps 2,3,4,5. THe result is not the same as doing Steps 1-5 in my program. Do I have to settle for always multiplying by the inverse in my program? Thanks for any suggestions -THACO

Share this post


Link to post
Share on other sites
Advertisement
No, you should be able to multiply the inverse matrices by each of the frame X bone matrices. Then use the result to do just 1 matrix multiply per weight for a vertex. If it's not working right, try reversing the order of the multiply (Inverse * Frame X Bone).

Share this post


Link to post
Share on other sites
In other words... Suppose the bones for any vertex are A, B, C, and D, and A0, B0, C0, and D0 are the "bind pose" values for the bones, and vwi is bone i's weight for vertex v. Your algorithm works like this:
    for every v
{
v' = vwAAA0-1v + vwBBB0-1v + vwCCC0-1v + vwDDD0-1v
}
Now, you can precompute the value of XX0-1 every frame. X' = XX0-1.

The new algorithm looks like this:
    A' = AA0-1
B' = BB0-1
C' = CC0-1
D' = DD0-1
for every v
{
v' = vwAA'v + vwBB'v + vwCC'v + vwDD'v
}
Furthermore, since your bones are not in a hierarchy, the value of A, B, C, and D come right out of the animation. You can further reduce the computation by storing the value X' for each bone in the animation instead of storing X and computing X' every frame.

Hope that makes sense.

BTW, you wrote that the vertexes are in world space. I assume you mean model space.

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.

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!