Hello all,
I am currently re-factoring my animation system to offload more work to the GPU. What I would like to do is something that is not uncommon: I would like to do my skeletal animations on the GPU in the Vertex Shader. I was able to find some code of others who have done this before me to get some guidance. One thing I noticed about pretty much every code sample I found was that each shader used a 4D vector for the bone weights. The implication here is that no vertex will be transformed by more than 4 bones. However, after analyzing one of my models, I am seeing a bunch of vertices in the model that have anywhere from 5-7 bone weights. I could add a 2nd 4D vector, or use a 4x4 matrix for the bone weights, to allow for more bone weights, at the expense of memory, however, I don't know what the right number of bone weights is.
How have other solved this? Is there any reason to use all the bone weights for a vertex, or is 4 enough for most vertices (in other words, ignoring anything beyond the first 4 bone weights)? or does it make sense to just support more bone weights, and hope that it never goes above my limit? Is there a way to export the model with a limit on bone weights per vertex?
I am happy to provide any additional information that is needed. Thanks.