WIP: Animation: Smoothing without Shrinkage #106365

Closed
Christoph Lendenfeld wants to merge 6 commits from ChrisLend/blender:curve_smoothing_fft into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

This patch attempts to implement this paper for FCurve smoothing: https://web.archive.org/web/20190222092630id_/http://pdfs.semanticscholar.org/346b/fa0b3cdc11b3a6f1ef4e6a296b1edbd0c215.pdf

Thanks to Fabian Achammer for helping me understand what the paper says in the first place.

So the gist of it is:

  • FFT transform the data into its frequency components
  • apply this in frequency space
    image
  • reverse the FFT

the main logic is in keyframes_general.c in case somebody is looking through the code

The FFT will be alright, since I am using the FFTW3 library.
Something must be wrong with the way I've implemented the logic in frequency space, most likely because I am not using the provided formula.

As far as I understand, the paper describes a frequency cutoff and a transition region.
Everything before the cutoff is unchanged, everything after the transition region is 0.
And everything in between lerps from 1-0, which is what I've done in code.

However the promise of no shrinkage isn't given as can be seen here
image

I think that also makes sense, if the high frequency tuples also have a high amplitude. But it might also be my limited understanding of the topic.

Now I am not sure if I can just apply a factor to the real and imaginary part of the FFT like I am doing.

This patch attempts to implement this paper for FCurve smoothing: https://web.archive.org/web/20190222092630id_/http://pdfs.semanticscholar.org/346b/fa0b3cdc11b3a6f1ef4e6a296b1edbd0c215.pdf Thanks to Fabian Achammer for helping me understand what the paper says in the first place. So the gist of it is: * FFT transform the data into its frequency components * apply this in frequency space ![image](/attachments/eb415968-9ea5-4287-80ea-748f2700a878) * reverse the FFT the main logic is in `keyframes_general.c` in case somebody is looking through the code The FFT will be alright, since I am using the FFTW3 library. Something must be wrong with the way I've implemented the logic in frequency space, most likely because I am not using the provided formula. As far as I understand, the paper describes a frequency cutoff and a transition region. Everything before the cutoff is unchanged, everything after the transition region is 0. And everything in between lerps from 1-0, which is what I've done in code. However the promise of no shrinkage isn't given as can be seen here ![image](/attachments/96ee30fb-98e0-4c78-b312-73db8852c797) I think that also makes sense, if the high frequency tuples also have a high amplitude. But it might also be my limited understanding of the topic. Now I am not sure if I can just apply a factor to the real and imaginary part of the FFT like I am doing.
Christoph Lendenfeld added 3 commits 2023-03-31 10:20:15 +02:00
Christoph Lendenfeld added 1 commit 2023-03-31 13:59:26 +02:00
Christoph Lendenfeld added 2 commits 2023-04-01 21:13:25 +02:00
Author
Member
closed in favor of [#106952: Animation: Butterworth Smoothing filter](https://projects.blender.org/blender/blender/pulls/106952)

Pull request closed

Sign in to join this conversation.
No reviewers
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
1 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#106365
No description provided.