GLTFLoader: Use a smaller bounding box for morph targets #18907
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Instead of assuming a worst case when the weight of each target is +-1,
assume that the sum of the weights is +-1 instead.
This isn't quite correct and may result in a bounding box that's too
small, but in at least one case - when morph targets are used for
keyframe animations and only two are active at a time - this results in
a much smaller bounding box.
In some other more realistic cases this may also reduce the bounding box
without a real impact on it being conservative, e.g. it's common to have
50 blend shapes for facial animations but only a few are active at a
time, and extreme deformations are typically contained within a box
that's computed with the new algorithm as well.
Fixes #18809.