Animation blendweight/bone compression

Started by
1 comment, last by deftware 11 years ago

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:

Before:

Bone IDs:

1, 2, 3, 4

Bone Weights:

0.23, 0.12, 0.49, 0.16

After:

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.

Thoughts?

Advertisement
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.

bitpacking the data before submitting to the shader and then unpacking it in the shader ?

This topic is closed to new replies.

Advertisement