Skip to content

Commit

Permalink
#152 Fixes additive animation blending issues
Browse files Browse the repository at this point in the history
Fixes additive animation blending issues due to wrong quaternion multiplication order in additive animation builder and blending job. Note that animations needs rebuild to benefit from the fix.
  • Loading branch information
blaztinn authored and guillaumeblanc committed Feb 17, 2024
1 parent 6b0d20e commit af9fbf3
Show file tree
Hide file tree
Showing 31 changed files with 11 additions and 6 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ The following authors have all licensed their contributions to ozz-animation und
- Mikołaj Siedlarek <mikolaj@siedlarek.net>
- Paul Gruenbacher <pgruenbacher@gmail.com>
- Christophe Meyer <christophe.meyer.pro@gmail.com>
- Blaž Tomažič <>
- Jan Krassnigg <jan@krassnigg.de>
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Next release
----------------------

* Library
- [offline/animation] #152 Fixes additive animation blending issues due to wrong quaternion multiplication order in additive animation builder and blending job. Note that animations needs rebuild to benefit from the fix.

* Build pipeline
- Adds CI for WebAssembly.

Expand Down
Binary file modified media/bin/astro_max_animation.ozz
Binary file not shown.
Binary file modified media/bin/astro_max_skeleton.ozz
Binary file not shown.
Binary file modified media/bin/astro_maya_animation.ozz
Binary file not shown.
Binary file modified media/bin/astro_maya_skeleton.ozz
Binary file not shown.
Binary file modified media/bin/baked_animation.ozz
Binary file not shown.
Binary file modified media/bin/pab_atlas_raw.ozz
Binary file not shown.
Binary file modified media/bin/pab_crackhead.ozz
Binary file not shown.
Binary file modified media/bin/pab_crackhead_additive.ozz
Binary file not shown.
Binary file modified media/bin/pab_crossarms.ozz
Binary file not shown.
Binary file modified media/bin/pab_curl_additive.ozz
Binary file not shown.
Binary file modified media/bin/pab_jog.ozz
Binary file not shown.
Binary file modified media/bin/pab_run.ozz
Binary file not shown.
Binary file modified media/bin/pab_skeleton.ozz
Binary file not shown.
Binary file modified media/bin/pab_splay_additive.ozz
Binary file not shown.
Binary file modified media/bin/pab_walk.ozz
Binary file not shown.
Binary file modified media/bin/robot_animation.ozz
Binary file not shown.
Binary file modified media/bin/robot_skeleton.ozz
Binary file not shown.
Binary file modified media/bin/robot_track_grasp.ozz
Binary file not shown.
Binary file modified media/bin/ruby_animation.ozz
Binary file not shown.
Binary file modified media/bin/ruby_mesh.ozz
Binary file not shown.
Binary file modified media/bin/ruby_skeleton.ozz
Binary file not shown.
Binary file modified media/bin/seymour_animation.ozz
Binary file not shown.
Binary file modified media/bin/versioning/animation_v6_be.ozz
Binary file not shown.
Binary file modified media/bin/versioning/animation_v6_le.ozz
Binary file not shown.
Binary file modified media/bin/versioning/raw_animation_v3_be.ozz
Binary file not shown.
Binary file modified media/bin/versioning/raw_animation_v3_le.ozz
Binary file not shown.
2 changes: 1 addition & 1 deletion src/animation/offline/additive_animation_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ math::Float3 MakeDeltaTranslation(const math::Float3& _reference,

math::Quaternion MakeDeltaRotation(const math::Quaternion& _reference,
const math::Quaternion& _value) {
return _value * Conjugate(_reference);
return Conjugate(_reference) * _value;
}

math::Float3 MakeDeltaScale(const math::Float3& _reference,
Expand Down
4 changes: 2 additions & 2 deletions src/animation/runtime/blending_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace {
const math::SoaQuaternion interp_quat = { \
rotation.x * _simd_weight, rotation.y * _simd_weight, \
rotation.z * _simd_weight, (rotation.w - one) * _simd_weight + one}; \
_out.rotation = NormalizeEst(interp_quat) * _out.rotation; \
_out.rotation = _out.rotation * NormalizeEst(interp_quat); \
_out.scale = \
_out.scale * (one_minus_weight_f3 + (_in.scale * _simd_weight)); \
} while (void(0), 0)
Expand All @@ -147,7 +147,7 @@ namespace {
const math::SoaQuaternion interp_quat = { \
rotation.x * _simd_weight, rotation.y * _simd_weight, \
rotation.z * _simd_weight, (rotation.w - one) * _simd_weight + one}; \
_out.rotation = Conjugate(NormalizeEst(interp_quat)) * _out.rotation; \
_out.rotation = _out.rotation * Conjugate(NormalizeEst(interp_quat)); \
const math::SoaFloat3 rcp_scale = { \
math::RcpEst(math::MAdd(_in.scale.x, _simd_weight, one_minus_weight)), \
math::RcpEst(math::MAdd(_in.scale.y, _simd_weight, one_minus_weight)), \
Expand Down
6 changes: 3 additions & 3 deletions test/animation/offline/additive_animation_builder_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ TEST(Build, AdditiveAnimationBuilder) {

// First track is empty
{
// input.tracks[0]
// input.tracks[0]
}

// 2nd track
Expand Down Expand Up @@ -202,7 +202,7 @@ TEST(BuildRefPose, AdditiveAnimationBuilder) {

// First track is empty
{
// input.tracks[0]
// input.tracks[0]
}

// 2nd track
Expand Down Expand Up @@ -284,7 +284,7 @@ TEST(BuildRefPose, AdditiveAnimationBuilder) {
output.tracks[1].rotations;
EXPECT_EQ(rotations.size(), 1u);
EXPECT_FLOAT_EQ(rotations[0].time, 0.f);
EXPECT_QUATERNION_EQ(rotations[0].value, .5f, .5f, -.5f, .5f);
EXPECT_QUATERNION_EQ(rotations[0].value, .5f, -.5f, -.5f, .5f);
const RawAnimation::JointTrack::Scales& scales = output.tracks[1].scales;
EXPECT_EQ(scales.size(), 1u);
EXPECT_FLOAT_EQ(scales[0].time, 0.f);
Expand Down

0 comments on commit af9fbf3

Please sign in to comment.