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!
GPU skinning, passing indices, weights and joints
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.
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.
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?
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?
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement