Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Gavrilov <angavrilov@gmail.com>2020-12-29 19:55:29 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-01-18 20:08:16 +0300
commitb5c3f26cba81c969a42255e689a26c1b7c89115b (patch)
tree9d719a63c7b7ef3ba0294200ec0dab0cd0ea6290 /source/blender/blenkernel/intern/armature.c
parent5e0ef4ef85e61d4714e1ee1b2c9714142067a664 (diff)
Armature: fix B-Bone deformation blending artifacts with Preserve Volume.
The double quaternion blending method in addition to the deformation matrix of each bone requires their rest matrices. For ordinary bones this literally should use the bone rest matrix without any ambiguity. However, it was also using the bone rest matrix for all of its B-Bone segments, which is incorrect and causes strange deformation in some cases involving extreme non-uniform scale, especially at boundaries between different B-Bones. There is also a similar known issue that happens with scale at bending joints, and this fix reduces the distortion when both bones are B-Bones. This changes both the Armature modifier and the Armature constraint to use the actual segment rest matrices. Unlike bones, these can have scale even in rest pose, so normalization is required. Differential Revision: https://developer.blender.org/D10003
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index a91183b95bd..4c9fb4b191a 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -1462,7 +1462,11 @@ void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
tmat,
b_bone_mats[0].mat);
- mat4_to_dquat(&b_bone_dual_quats[a], bone->arm_mat, b_bone_mats[a + 1].mat);
+ /* Compute the orthonormal object space rest matrix of the segment. */
+ mul_m4_m4m4(tmat, bone->arm_mat, b_bone_rest[a].mat);
+ normalize_m4(tmat);
+
+ mat4_to_dquat(&b_bone_dual_quats[a], tmat, b_bone_mats[a + 1].mat);
}
}