Issue with bake action and constrained bone under scaled parent #106980

Closed
opened 2023-04-15 09:55:37 +02:00 by RomainTestylier · 3 comments

System Information
Operating system: Windows 10
Graphics card: NVIDIA GeForce RTX 3060

Blender Version
Broken: 2.83.20, 2.93.16, 3.4.1, 3.5.0

Short description of error
In a rig with a constrained bone with StretchTo or Lookat constraint and a scaled parent, the action baking give a wrong bone rotation and scale.

Exact steps for others to reproduce the error

  • Using the attached blend file select the initial rig named Armature,
  • F3 -> Bake Action
  • Disable the option Only Selected Bones, Enable Visual Keying and Clear Constraint and select Pose as Bake Data
  • Press OK and the animation is not the same anymore.
**System Information** Operating system: Windows 10 Graphics card: NVIDIA GeForce RTX 3060 **Blender Version** Broken: 2.83.20, 2.93.16, 3.4.1, 3.5.0 **Short description of error** In a rig with a constrained bone with StretchTo or Lookat constraint and a scaled parent, the action baking give a wrong bone rotation and scale. **Exact steps for others to reproduce the error** * Using the attached blend file select the initial rig named Armature, * F3 -> Bake Action * Disable the option Only Selected Bones, Enable Visual Keying and Clear Constraint and select Pose as Bake Data * Press OK and the animation is not the same anymore.
RomainTestylier added the
Priority
Normal
Status
Needs Triage
Type
Report
labels 2023-04-15 09:55:38 +02:00
Iliya Katushenock added the
Interest
Animation & Rigging
label 2023-04-15 10:23:47 +02:00
Member

Okay, so this is a tricky one. TLDR; this isn't a bug per se, but a limitation.

The issue is that:

  1. The bone with the Stretch To constraint has a parent with non-uniform scaling. This means that the bone is in a sheared space.
  2. The Stretch To constraint apparently overrides this sheared space, and transforms the constrained bone as if it were in a non-sheared world space. This effectively introduces shear into the constrained bone's transforms, to counteract the shear of the parent space to make it look unsheared in world space.

Together, this means the transform caused by the Stretch To constraint is literally unrepresentable by the loc/rot/scale channels of the bone. They can only represent location, rotation, and scale, not shear. Hence, the shear of the bone (which is counteracting the shear introduced by the parent) gets lost when baking down to those transform channels.

Notably, this issue is not limited to the Stretch To constraint. It can also be caused by the Copy Transforms constraint (I've attached an example blend file of that), and possibly others as well (I haven't checked).

Although this is admittedly a counterintuitive behavior, it's not actually a bug. It's just a natural limitation of how transforms are represented in Blender (and most other software, for that matter). Loc/rot/scale channels can't represent shear, and thus those shear effects get lost when baking down to those channels.

At the moment, the solutions are user-side. Two solutions that come to mind are:

  1. Change your rig to avoid shearing any bones. This is often (but not always) possible. But it does require a bit of knowledge. In the example blends so far, a good solution would be to replace the parent-child relationship with Copy Location and/or Copy Rotation constraints as appropriate.
  2. Don't use Clear Constraints when baking, leaving the full rig (and thus the effect of the constraints) intact. Depending on circumstance, this is not always a feasible solution (e.g. if it's being baked for export to a game engine).

A possible solution in the future might be an option to bake animations down to transform matrices rather than loc/rot/scale channels. That way all transforms--regardless of source--could be fully represented. Although if this is for export that may not fully solve the issue since the software/game engine/whatever that the animation is being imported to might only support loc/rot/scale channels for animation anyway, and then you'd be back to the same problem.

Okay, so this is a tricky one. TLDR; this isn't a bug per se, but a limitation. The issue is that: 1. The bone with the `Stretch To` constraint has a parent with non-uniform scaling. This means that the bone is in a *sheared* space. 2. The `Stretch To` constraint apparently **overrides** this sheared space, and transforms the constrained bone as if it were in a non-sheared world space. This effectively *introduces* shear into the constrained bone's transforms, to counteract the shear of the parent space to make it look unsheared in world space. Together, this means the transform caused by the `Stretch To` constraint is literally *unrepresentable* by the loc/rot/scale channels of the bone. They can only represent location, rotation, and scale, not shear. Hence, the shear of the bone (which is counteracting the shear introduced by the parent) gets lost when baking down to those transform channels. Notably, this issue is not limited to the `Stretch To` constraint. It can also be caused by the `Copy Transforms` constraint (I've attached an [example blend file](/attachments/61da51dc-7ce1-4b2c-881f-35d804d3323a) of that), and possibly others as well (I haven't checked). Although this is admittedly a *counterintuitive* behavior, it's not actually a bug. It's just a natural limitation of how transforms are represented in Blender (and most other software, for that matter). Loc/rot/scale channels can't represent shear, and thus those shear effects get lost when baking down to those channels. At the moment, the solutions are user-side. Two solutions that come to mind are: 1. Change your rig to avoid shearing any bones. This is often (but not always) possible. But it does require a bit of knowledge. In the example blends so far, a good solution would be to replace the parent-child relationship with `Copy Location` and/or `Copy Rotation` constraints as appropriate. 2. Don't use `Clear Constraints` when baking, leaving the full rig (and thus the effect of the constraints) intact. Depending on circumstance, this is not always a feasible solution (e.g. if it's being baked for export to a game engine). A possible solution in the future might be an option to bake animations down to *transform matrices* rather than loc/rot/scale channels. That way all transforms--regardless of source--could be fully represented. Although if this is for export that may not fully solve the issue since the software/game engine/whatever that the animation is being imported to might only support loc/rot/scale channels for animation anyway, and then you'd be back to the same problem.

I'd like to add a 3rd option to the above suggestions:

image

There is a bone setting 'Inherit Scale' that can be used to remove sheer. That way you can retain the parent-child relationship and still avoid such issues.

I'd like to add a 3rd option to the above suggestions: ![image](/attachments/a22d705c-43b8-4370-9572-1a48c0778078) There is a bone setting 'Inherit Scale' that can be used to remove sheer. That way you can retain the parent-child relationship and still avoid such issues.
Member

Closing because it's not a bug. (But the limitation is on our radar.)

Closing because it's not a bug. (But the limitation is on our radar.)
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-05-01 11:37:35 +02:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#106980
No description provided.