Jump to content
  • Advertisement
Sign in to follow this  

Animation blendweight/bone compression

This topic is 1933 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

Had an idea the other day (in the shower of all places) that I thought I might offer up, not sure if it's been done before...  To do GPU skinning, we (well, I) supply a vector/array of floats for the weights and a vector/array of floats for the bone numbers/IDs.


As the weights are always <= 1, it struct me that we are effectively wasting the integer part of the weight as it's always zero, so how about we store the bone id in the integer part, like this:



Bone IDs:

1, 2, 3, 4


Bone Weights:

0.23, 0.12, 0.49, 0.16




Bone IDS/Weights:

1.23, 2.12, 3.49, 4.16


As you can see, we halve the data being passed to the shader and the memory footprint of the skinning data. You might think that this wouldn't work for vertices affected by one bone - but this can be achieved by sending:


1.5, 1.5


So effectively the vertex is linked twice to the same bone by 0.5 each - skinning calcs should iron this out nicely.


(int) will give us both parts in the shader.



Share this post

Link to post
Share on other sites
I've seen tricks like this used before -- you can use floor and frac to get the integer and fractional parts of a float.
However, in all the recent skinning implementations I've used, the vertex data has been an integer byte4 of IDs and a fractional/normalized byte4 of weights, which is still half the size of a single float4.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!