Jump to content

  • Log In with Google      Sign In   
  • Create Account


GPU skinning, passing indices, weights and joints


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 pondwater   Members   -  Reputation: 191

Like
0Likes
Like

Posted 13 July 2012 - 02:57 PM

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!

Sponsor:

#2 clb   Members   -  Reputation: 1776

Like
1Likes
Like

Posted 13 July 2012 - 03:32 PM

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.
Me+PC=clb.demon.fi | C++ Math and Geometry library: MathGeoLib, test it live! | C++ Game Networking: kNet | 2D Bin Packing: RectangleBinPack | Use gcc/clang/emcc from VS: vs-tool | Resume+Portfolio | gfxapi, test it live!

#3 Hodgman   Moderators   -  Reputation: 26995

Like
2Likes
Like

Posted 13 July 2012 - 11:55 PM

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.

#4 pondwater   Members   -  Reputation: 191

Like
1Likes
Like

Posted 16 July 2012 - 03:40 PM

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?

#5 clb   Members   -  Reputation: 1776

Like
0Likes
Like

Posted 16 July 2012 - 03:44 PM

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.
Me+PC=clb.demon.fi | C++ Math and Geometry library: MathGeoLib, test it live! | C++ Game Networking: kNet | 2D Bin Packing: RectangleBinPack | Use gcc/clang/emcc from VS: vs-tool | Resume+Portfolio | gfxapi, test it live!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS