Jump to content
  • Advertisement
Sign in to follow this  
pondwater

GPU skinning, passing indices, weights and joints

This topic is 2342 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've got my skinning proceedure running on the cpu so far, just to make sure i had it all working properly.

Now I would like to move it to the gpu. I've looked at this tutorial http://3dgep.com/?p=1356

They passed the joint matrices as uniforms and vertex weights and indices as attributes using VBO's

I was wondering, is this how it is commonly done? Is there an efficient way to get 5+ influences per bone? Do i really need 5+ influences per bone? Any experience, tutorial links or input into this would really help!

Share this post


Link to post
Share on other sites
Advertisement

They passed the joint matrices as uniforms and vertex weights and indices as attributes using VBO's

I was wondering, is this how it is commonly done?


Yes, this is the standard. Since each vertex is affected by a different set of bones, you will need random access to the bone matrix palette in the vertex shader. The nice thing with this approach is that the VBO data stays always constant, and only the uniforms change.

The other sometimes seen option is to store the bone matrices in textures, and sample the textures from the vertex shader to read the bone matrices. This is done just to avoid the upper limit on the number of constants one can have, since texture memory can hold much more data. This method requires Vertex Texture Fetch support.

If you need more than four bone influences per vertex, you can use multiple vertex attributes for that, but that naturally increases processing costs. Using four influences is a kind of middle ground, and fits nicely to 4D vectors.

Share this post


Link to post
Share on other sites
Is there an efficient way to get 5+ influences per bone? Do i really need 5+ influences per bone?
Usually 4 is enough. When I compile model files, if any vertex has 5 weights/indices, then I discarded the index with the smallest weight, and then renormalise the remaining weights so they add up to 1.0 again.
In complex situations, you might need more than 4, but every game I've worked on has either used 1, 2 or 4 weights/indices as the max.

Share this post


Link to post
Share on other sites
Thank you both for your replies! I will use VBO to store my indices and weights.

I interweave my vertices, normals, texture coords into a single VBO. Since my weights and indices are static, should I interweave them within the same VBO or would you recommend using seperate buffer?

Share this post


Link to post
Share on other sites
The preferred method is to interleave all vertex array data, so that the elements for a single vertex are always next to each other. Using planar formats are slower on all GPUs, perhaps only good to use in some odd buffer update pattern cases.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!