Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Need guidance regarding GPU Skeletal Animation.

  • You cannot reply to this topic
1 reply to this topic

#1 metsfan   Members   -  Reputation: 462

Like
0Likes
Like

Posted Today, 06:54 PM

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.



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 13606

Like
0Likes
Like

Posted Today, 07:49 PM

In my model importer, I find the largest 4 weights, discard the rest, then renormalize these 4 so that they add up to 1.0.

In complex situations, it may be that 5+ are required, but it depends... In one game that I worked on, we use 'skinning LOD', where close characters would use 4 weights, medium distance would use 2 and distant characters just 1.
Pretty much every curren engine that I've used is limited to 4 bones per vertex, and next-gen games seem to be supporting 8 per vertex where required.





PARTNERS