Euler rotation is wrapped to 180 degrees when Baking Animations #116484

Open
opened 2023-12-23 07:32:14 +01:00 by Andrej · 4 comments
Contributor

Blender Version
Broken: 4.0.2

Short description of error
Baking animation is losing rotation data if rotation is over 360 degrees.
This unrequested change in value can mess up drivers that expect the previous value to evaluate.

Before bake: After bake:
blender_E1g2F1W2Vr.png blender_cYHmUYCBwA.png

So there are two possible issues:

  1. Driver seems to be resolved only after all degrees were recalculated, therefore it bakes to incorrect value.
  2. Bone_01 original rotation data is changed too though visually it will look the same here.

Exact steps for others to reproduce the error

Bone_01, that was before animated in Y rotation with 450-488 degrees, is now 90-125 degrees;
Bone_02, that was reusing Bone_01 rotation (divided by 10) through driver, before it's rotation was 45-48.5 degrees, now it is 9-12.5 degrees;

So, at least for Bone_02, rotation is now completely different visually.

The original use case was an animated mechanism where one part (kind of a gear) was partially reusing rotation from another part.

**Blender Version** Broken: 4.0.2 **Short description of error** Baking animation is losing rotation data if rotation is over 360 degrees. This unrequested change in value can mess up drivers that expect the previous value to evaluate. |Before bake:|After bake:| |--|--| |![blender_E1g2F1W2Vr.png](/attachments/e6b89259-4e6c-45c0-8b20-1f7f637ac49f)|![blender_cYHmUYCBwA.png](/attachments/7524f3c9-6815-4727-990c-fbe0d1338e8e)| So there are two possible issues: 1) Driver seems to be resolved only after all degrees were recalculated, therefore it bakes to incorrect value. 2) Bone_01 original rotation data is changed too though visually it will look the same here. **Exact steps for others to reproduce the error** - Open .blend file [TEST_rotation_over_360_deg_bake.blend](/attachments/2fe89ed2-60dc-4a84-9e6d-0d8f90dc0243) - Select both bones - Pose -> Animation -> Bake Action and use the settings below: ![blender_aqoMZ11UTE.png](/attachments/232a95b4-0e6b-49b6-951e-1b741c965b64) Bone_01, that was before animated in Y rotation with 450-488 degrees, is now 90-125 degrees; Bone_02, that was reusing Bone_01 rotation (divided by 10) through driver, before it's rotation was 45-48.5 degrees, now it is 9-12.5 degrees; So, at least for Bone_02, rotation is now completely different visually. The original use case was an animated mechanism where one part (kind of a gear) was partially reusing rotation from another part.
Andrej added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-12-23 07:32:15 +01:00
Germano Cavalcante changed title from Baking animation is losing rotation data if rotation is over 360 degrees / losing drived values after bake to Euler rotation is wrapped to 180 degrees when Baking Animations 2023-12-26 18:28:45 +01:00

I can confirm the issue.
The rotation data seems to be wrapped to 180 degrees when baking animations, which can cause problems with drivers and result in incorrect values.
I will forward this issue to the developers for further investigation.
Thank you for reporting it.

I can confirm the issue. The rotation data seems to be wrapped to 180 degrees when baking animations, which can cause problems with drivers and result in incorrect values. I will forward this issue to the developers for further investigation. Thank you for reporting it.
Germano Cavalcante added
Module
Animation & Rigging
Status
Confirmed
and removed
Status
Needs Triage
labels 2023-12-26 18:30:10 +01:00
Member

I believe we can support preserving > 180 degree euler values in some specific cases, but it isn't something we can preserve in the general case.

For example, if a bone has a constraint on it and you bake with visual keying, the baking process basically has to use transform matrices as an intermediary. And thus any aspect of rotation that a matrix can't represent (which includes > 180 rotation) will get lost. Moreover, there's no guarantee that the resulting constrained position even has a reasonable mapping to the >180 rotation in the original channels at all.

But if there are no constraints on a bone, then we can (I think) just directly bake the channel values, which would preserve everything. There also may be some cases where we can make a good guess even when things are constrained, although I'm not sure how reliably.

In any case, I think this essentially amounts to a feature request, rather than a bug. In the general case >180 rotation can't be preserved with the Bake Action operator, and I suspect that's why it's not currently supported. So it's an intentional and known limitation.

I realize, however, that this is counterintuitive for end users, because on the surface it seems like this should be really simple. But rotations are a lot more complex than end users generally realize. Nevertheless, I agree it would be good to support this where we can.

I believe we can support preserving > 180 degree euler values in some specific cases, but it isn't something we can preserve in the general case. For example, if a bone has a constraint on it and you bake with visual keying, the baking process basically has to use transform matrices as an intermediary. And thus any aspect of rotation that a matrix can't represent (which includes > 180 rotation) will get lost. Moreover, there's no guarantee that the resulting constrained position even has a reasonable mapping to the >180 rotation in the original channels at all. But if there are no constraints on a bone, then we can (I think) just directly bake the channel values, which would preserve everything. There also may be some cases where we can make a good guess even when things are constrained, although I'm not sure how reliably. In any case, I think this essentially amounts to a feature request, rather than a bug. In the general case >180 rotation can't be preserved with the Bake Action operator, and I suspect that's why it's not currently supported. So it's an intentional and known limitation. I realize, however, that this is counterintuitive for end users, because on the surface it seems like this should be really simple. But [rotations are a lot more complex](https://www.youtube.com/watch?v=SZE_KOjreAs&list=PLE211C8C41F1AFBAB) than end users generally realize. Nevertheless, I agree it would be good to support this where we can.
Sybren A. Stüvel added
Status
Needs Information from User
and removed
Status
Confirmed
labels 2024-02-05 11:23:49 +01:00

I suspect this is due to the "Visual Keying" option that's enabled. This only considers the final orientation of the object or bone, and not the method by which it arrived there. @Andrej730 please try what happens with that option disabled.

Given that this report is already a few months old, I tested it myself. My suspicions were wrong, and the normalisation of the rotation also happens without the "Visual Keying" option.

I'll relabel this as 'known issue'. It's simply a limitation of how the current baking is implemented (all transform computations just take the matrix representation), and not a bug. It is good to keep this in mind for when we design a new animation baking system, though.

~~I suspect this is due to the "Visual Keying" option that's enabled. This only considers the final orientation of the object or bone, and not the method by which it arrived there. @Andrej730 please try what happens with that option disabled.~~ Given that this report is already a few months old, I tested it myself. My suspicions were wrong, and the normalisation of the rotation also happens without the "Visual Keying" option. I'll relabel this as 'known issue'. It's simply a limitation of how the current baking is implemented (all transform computations just take the matrix representation), and not a bug. It is good to keep this in mind for when we design a new animation baking system, though.
Member

I tested it with the visual keying option disabled, and it still fails to preserve absolute degrees of rotation. The only difference with visual keying disabled seems to be that it ignores constraints, etc. But it still maps the euler degrees to < 180 degrees.

However, it is smart enough to bake to the euler angle that's closest to the previous baked frame. So although the initial frame gets mapped to < 180 degrees, a continuous rotation will happily continue beyond 180 degrees, rather than suddenly jumping to wrap back around mid-animation.

I tested it with the visual keying option disabled, and it still fails to preserve absolute degrees of rotation. The only difference with visual keying disabled seems to be that it ignores constraints, etc. But it still maps the euler degrees to < 180 degrees. However, it *is* smart enough to bake to the euler angle that's closest to the previous baked frame. So although the initial frame gets mapped to < 180 degrees, a continuous rotation will happily continue beyond 180 degrees, rather than suddenly jumping to wrap back around mid-animation.
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
4 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#116484
No description provided.