Animation: add a "minimal influence" or sort influ

What it says on the tin: a place to discuss proposed new features.
Post Reply
Chatterbox
Kobold
Posts: 28
Joined: Tue Dec 05, 2006 9:39 pm

Animation: add a "minimal influence" or sort influ

Post by Chatterbox »

Here's some code of VertexAnimationTrack::applyPoseToVertexData (ogre 1.4.9)

Code: Select all

// no use for TempBlendedBufferInfo here btw
// Set pose target as required
size_t hwIndex = data->hwAnimDataItemsUsed++;
// If we try to use too many poses, ignore extras
if (hwIndex < data->hwAnimationDataList.size())
However, when using animation, many of the influences will be near zero, but not exactly zero. This is a problem when you have a hardware pose-blend shader that accepts e.g. a maximal of 4 active poses: the poses of highest influence will not be considered, because the close-to-zero ones can take precedence.

For a really easy hack, I did

Code: Select all

const float epsilon = 1e-3f;
if( fabs(influence) > epsilon )
{
   size_t hwIndex = data->hwAnimDataItemsUsed++;
However, a proper solution would sort all the influences, pick the N largests ones, and emit a warning if the magnitude of the remaining influences is larger than a threshold.
Post Reply