Graph Editor Normalization broken by Keyframe that uses Easing or Dynamic interpolation #67274

Closed
opened 2019-07-20 02:25:04 +02:00 by Sam Brubaker · 10 comments

Version: 2.80 rc2 (Linux 64)

f-curve_normalize_bug.blend

How to reproduce:

  • Inspect the file (a cube with one animated value)
  • Change the interpolation type of the first keyframe to one of the "easing" methods (Sine, Quadratic, Cubic, etc.)

Observe what happens to the normalization of the curve!

This is not the expected behavior. Neither of the two keyframe values have been changed, so the apparent Y-scale of the curve should not change either. It seems like some interpolation types break whatever function is used to normalize the curve. The behavior is difficult to predict though; for instance, the bug will not initially appear if the interpolation type of the last keyframe in the example is changed.

Version: 2.80 rc2 (Linux 64) [f-curve_normalize_bug.blend](https://archive.blender.org/developer/F7619253/f-curve_normalize_bug.blend) **How to reproduce:** - Inspect the file (a cube with one animated value) - Change the interpolation type of the first keyframe to one of the "easing" methods (Sine, Quadratic, Cubic, etc.) # Observe what happens to the normalization of the curve! This is not the expected behavior. Neither of the two keyframe values have been changed, so the apparent Y-scale of the curve should not change either. It seems like some interpolation types break whatever function is used to normalize the curve. The behavior is difficult to predict though; for instance, the bug will not initially appear if the interpolation type of the last keyframe in the example is changed.
Author

Added subscriber: @rocketman

Added subscriber: @rocketman

Added subscriber: @zeauro

Added subscriber: @zeauro

This is not expected behavior but it looks like a bug that was present in 2.79, too.

This is not expected behavior but it looks like a bug that was present in 2.79, too.
Author

I believe it! Perhaps this has gone undetected because "easing" and "normalize" are both under-utilized in Blender. But it's definitely not helpful.

I don't know anything about the code for this feature, but suspect that the bug may be caused by the whole thing being too complicated. For instance, this graph (not the example file) shows two curves which start at -10.0 and end at 10.0:
Untitled.png
The actual value of those two end keyframes equals 10, but the blue curve is normalized by a greater factor, because Blender wants to normalize based on the extreme of the curve itself, not just the keyframe values. So there must be a function for calculating the extreme, which gets broken by the newer interpolation types.

Maybe the whole mess could be fixed by ignoring interpolated points and only taking the keyframe values into account, but that might break certain workflows. Personally, I think it might be helpful to view overshooting curves as going beyond the normalized range of -1.0...1.0, though.

I believe it! Perhaps this has gone undetected because "easing" and "normalize" are both under-utilized in Blender. But it's definitely not helpful. I don't know anything about the code for this feature, but suspect that the bug may be caused by the whole thing being too complicated. For instance, this graph (not the example file) shows two curves which start at -10.0 and end at 10.0: ![Untitled.png](https://archive.blender.org/developer/F7621078/Untitled.png) The actual value of those two end keyframes equals 10, but the blue curve is normalized by a greater factor, because Blender wants to normalize based on the extreme of the curve itself, not just the keyframe values. So there must be a function for calculating the extreme, which gets broken by the newer interpolation types. Maybe the whole mess could be fixed by ignoring interpolated points and *only* taking the keyframe values into account, but that might break certain workflows. Personally, I think it might be helpful to view overshooting curves as going beyond the normalized range of -1.0...1.0, though.

Added subscribers: @Sergey, @ZedDB

Added subscribers: @Sergey, @ZedDB
Sebastian Parborg self-assigned this 2019-07-29 14:42:18 +02:00

@Sergey The issue here is that the code doesn't handle the (newish) interpolation type. A quick and dirty fix would to just treat it as a normal curve:

diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index 61bf7f95340..6965c3418e2 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -438,7 +438,7 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo
           max_coord = max_ff(max_coord, prev_bezt->vec[1][1]);
           min_coord = min_ff(min_coord, prev_bezt->vec[1][1]);
         }
-        else if (prev_bezt->ipo == BEZT_IPO_BEZ) {
+        else if (prev_bezt->ipo >= BEZT_IPO_BEZ) {
           const int resol = fcu->driver ?
                                 32 :
                                 min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])),

However, this is not correct and will lead to other inconsistencies/problems.
So I'm guessing that we should create some general function for this?

I'm also guessing that one could use the functions in blender/blenkernel/intern/fcurve.c to do this. However, it seems like those are only sampled, so if I use those, the scaling might jump around because of missed max/min points.

@Sergey The issue here is that the code doesn't handle the (newish) interpolation type. A quick and dirty fix would to just treat it as a normal curve: ``` diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 61bf7f95340..6965c3418e2 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -438,7 +438,7 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo max_coord = max_ff(max_coord, prev_bezt->vec[1][1]); min_coord = min_ff(min_coord, prev_bezt->vec[1][1]); } - else if (prev_bezt->ipo == BEZT_IPO_BEZ) { + else if (prev_bezt->ipo >= BEZT_IPO_BEZ) { const int resol = fcu->driver ? 32 : min_ii((int)(5.0f * len_v2v2(bezt->vec[1], prev_bezt->vec[1])), ``` However, this is not correct and will lead to other inconsistencies/problems. So I'm guessing that we should create some general function for this? I'm also guessing that one could use the functions in `blender/blenkernel/intern/fcurve.c` to do this. However, it seems like those are only sampled, so if I use those, the scaling might jump around because of missed max/min points.

@ZedDB, ideally should indeed share code, so the drawing and normalization are based on same exact things.
Surely, there could be some missed extremum which falls between of sampling points, but it will be missing for drawing as well then. So I wouldn't worry about this.

@ZedDB, ideally should indeed share code, so the drawing and normalization are based on same exact things. Surely, there could be some missed extremum which falls between of sampling points, but it will be missing for drawing as well then. So I wouldn't worry about this.

I've posted a fix here: D5365

I've posted a fix here: [D5365](https://archive.blender.org/developer/D5365)

This issue was referenced by edb3b7a323

This issue was referenced by edb3b7a323a1808da9e9ab7c8b268cafc1671207

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
5 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#67274
No description provided.