Fix #110169: nearly flat normalized fcurves jump around in editor #110796
No reviewers
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
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
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
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
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
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
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#110796
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "nathanvegdahl/blender:fix_110169_broken_fcurve_normalization"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The root cause was a classic fixed-size epsilon issue. The code that
checked if an fcurve was effectively flat, and thus shouldn't be
normalized, used a fixed-size epsilon that was reasonable for values
close-ish to zero, but didn't work well for values >= 1.0.
This patch addresses the issue by introducing a robust ulps-based
comparison, to ensure that a minimum number of representable floats
exist between the min/max values of the curve. This approach scales
appropriately up and down to both huge and tiny values.
I wrote a new ulps-based function
ulp_diff_ff()
to implement this fix. I think this new function will generally be useful in resolving certain kinds of floating point issues in the future as well. The advantage of it over the existingcompare_ff_relative()
is that the latter also includes a standard epsilon-based comparison, and if the epsilon is zero the ulps-based comparison doesn't work correctly between floats of different sign. So this new function allows robust pure ulps-based thresholds to be used.However, I can sometimes be a little overzealous about floating point issues. So maybe this is overkill. I'm also not totally sure if I've even put the function in the best place (e.g. maybe one of the new C++ files would be a better place for new functions?).
Can we use
ulp_diff_ff
in the implementation ofcompare_ff_relative
, since it seems like it would correct some issues there?I think there's usually a good reason to do both absolute and relative comparisons like
compare_ff_relative
. Relative differences don't work well near zero, there can be bigger errors when the value comes from a computation that involved bigger values.ulp_diff_ff(min_coord, max_coord) > 64
this means there are 64 floating point steps between min and max?I think we can bump that even further since the drawing is still a bit weird at that value
The difference between the values here is 0.00001
Will do.
Agreed.
compare_ff_relative
definitely has its place as well. But in some cases (such as this fix, I think) a pure ulp-based approach is more appropriate. It's good to have both available.Good call. I was trying to be conservative, but I think you're right that I was being over-conservative in this case.
@blender-bot build