Page MenuHome

Armature: add Inherit Scale options to remove shear or average the scale.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Sun, Aug 25, 6:05 PM.

Details

Summary

As an inherent property of matrix-based transformation math, non-
uniform scaling of a parent bone induces shear into the transform
matrix of any rotated child. Such matrices cannot be cleanly
decomposed into a combination of location/rotation/scale, which
causes issues for rigging and animation tools.

Blender bones have options to exclude rotation and/or scale from the
inherited transformation, but don't have any support for removing the
often undesired shear component. That goal requires replacing simple
parenting with a combination of multiple bones and constraints. The
same is true about the goal of inheriting some scale, but completely
avoiding shear.

This patch replaces the old Inherit Scale checkbox with a enum that
supports multiple options:

  • Full: inherit all effects of scale, like with enabled Inherit.
  • Fix Shear: removes shear from the final inherited transformation. The cleanup math is specifically designed to preserve the main axis of the bone, its length and total volume, and minimally affect roll on average. It however will not prevent reappearance of shear due to local rotation of the child.
  • Average: inherit uniform scale that represents the overall volume change of the parent. This is the easiest foolproof solution that will inherit some scale without ever causing shear.
  • None: completely remove scale and shear.
  • None (Legacy): old disabled Inherit Scale checkbox. This mode does not handle parent shear in any way, so the child is likely to end up having both scale and shear. It is retained purely for backward compatibility.

Since many rigging-related addons access the use_inherit_scale
property from Python, it is retained as a backward compatibility
stub that provides the old functionality, but spams the console.
It should be removed once addons are updated.

As a side effect of reworking the code, this also fixes a matrix
multiplication order bug in the Inherit Rotation code, which caused
the parent local scale to be applied in world space. In rigger
opinion this option is useless in production rigs, so this fix
should not be a problem.

Diff Detail

Repository
rB Blender

Event Timeline

Brecht Van Lommel (brecht) added inline comments.
source/blender/blenlib/intern/math_matrix.c
1542

For performance, this could early out before computing saacosf() since that is relatively slow.

This revision is now accepted and ready to land.Thu, Aug 29, 1:03 PM

Reworked by changing Inherit Scale into a dropdown instead of adding checkboxes.

Alexander Gavrilov (angavrilov) retitled this revision from Armature: add an option to remove shear from inherited parent transform. to Armature: add Inherit Scale options to remove shear or average the scale..Sat, Aug 31, 9:24 AM
Alexander Gavrilov (angavrilov) edited the summary of this revision. (Show Details)

Looks good to me if we get rid of the prints.

source/blender/makesrna/intern/rna_armature.c
307–320

Printing messages on read/write like this could be a problem. There may be scripts that loop over all properties of a bone, and then you get hard to fix prints in such code.

I suggest to just mention the deprecation in the description property description and remove the prints. We can keep the boolean property for quite a while, it's not really in the way.