Sign in to follow this  

Animation blendweight/bone compression

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this