Bug 456731

Summary: transform mask animation seems to only interpolate translation with integer values.
Product: [Applications] krita Reporter: Gontran Baudeur <bourdul>
Component: AnimationAssignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: minor CC: ahab.greybeard, dimula73
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: a krita file that showcases the transform mask interpolation issue
transform mask interpolation with rotation added

Description Gontran Baudeur 2022-07-14 21:21:11 UTC
Created attachment 150634 [details]
a krita file that showcases the transform mask interpolation issue

SUMMARY
***
the transform mask, when animated with keyframes, and when not scaled nor rotated, gives snappy interpolated positions

here's the git hash : 447fc4964a
***


STEPS TO REPRODUCE
open the attached file and play the animation, OR :

1. create a layer and put any brush stroke on it
2. create a transform mask for this layer
3. with the animation curve docker create two keyframes that makes the layer move in translation,the movement should be rather short, you should not touch the scale nor rotation.

OBSERVED RESULT
the interpolation seems to only work with integer values which makes the movement quite hashed

EXPECTED RESULT
the expected result is to have sub pixel translations which would make a re-sampling of the image to make the movement appear smoother.

SOFTWARE/OS VERSIONS
Windows: 10

ADDITIONAL INFORMATION
Comment 1 Ahab Greybeard 2022-07-15 06:32:51 UTC
Created attachment 150641 [details]
transform mask interpolation with rotation added

I can Confirm this using the July 14th 5.2.0-prealpha (git a40c36155f) appimage on Debian 10.

Manual and animated mask transforms of x-position and y-position are limited to integer pixel movements.

If a small amount of rotation is done at the same time, e.g. 0.01 degrees Z-rotation, then sub-pixel x/y position transforms are performed with associated 'anti-aliasing' type of appearance.

The OP's example file with this rotation added has been  attached.

A similar effect happens if a small amount of scale change is done at the same time.
Comment 2 Dmitry Kazakov 2023-10-16 15:40:07 UTC
Yeah, that is a kind of "optimization" we have in the transform worker :)
Comment 3 Dmitry Kazakov 2023-10-18 16:04:08 UTC
Will be fixed in https://invent.kde.org/graphics/krita/-/merge_requests/1958
Comment 4 Dmitry Kazakov 2023-10-23 15:09:36 UTC
Git commit 3acce3f9d368c2911994149f7a80c571a542c901 by Dmitry Kazakov.
Committed on 23/10/2023 at 17:08.
Pushed by dkazakov into branch 'master'.

Fix rounding in animated transform masks with translation

M  +11   -1    libs/image/kis_perspectivetransform_worker.cpp
M  +4    -0    libs/image/kis_perspectivetransform_worker.h
M  +4    -1    libs/image/kis_transform_mask.cpp
M  +3    -1    libs/image/kis_transform_mask_params_interface.h
M  +11   -0    libs/image/kis_transform_worker.cc
M  +4    -0    libs/image/kis_transform_worker.h
M  +5    -0    plugins/tools/tool_transform2/KisAnimatedTransformMaskParamsHolder.cpp
M  +2    -0    plugins/tools/tool_transform2/KisAnimatedTransformMaskParamsHolder.h
M  +2    -2    plugins/tools/tool_transform2/kis_transform_mask_adapter.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_transform_mask_adapter.h
M  +8    -4    plugins/tools/tool_transform2/kis_transform_utils.cpp
M  +2    -1    plugins/tools/tool_transform2/kis_transform_utils.h
M  +5    -0    sdk/tests/KisDumbAnimatedTransformMaskParamsHolder.cpp
M  +2    -0    sdk/tests/KisDumbAnimatedTransformMaskParamsHolder.h
M  +2    -1    sdk/tests/KisDumbTransformMaskParams.cpp
M  +1    -1    sdk/tests/KisDumbTransformMaskParams.h

https://invent.kde.org/graphics/krita/-/commit/3acce3f9d368c2911994149f7a80c571a542c901
Comment 5 Dmitry Kazakov 2024-02-28 18:09:47 UTC
Git commit 10d1ef8f65115c9fd85eac7d5bea644ccd1af023 by Dmitry Kazakov.
Committed on 28/02/2024 at 12:42.
Pushed by dkazakov into branch 'kazakov/for-5.2'.

Fix rounding in animated transform masks with translation

M  +11   -1    libs/image/kis_perspectivetransform_worker.cpp
M  +4    -0    libs/image/kis_perspectivetransform_worker.h
M  +4    -1    libs/image/kis_transform_mask.cpp
M  +3    -1    libs/image/kis_transform_mask_params_interface.h
M  +11   -0    libs/image/kis_transform_worker.cc
M  +4    -0    libs/image/kis_transform_worker.h
M  +5    -0    plugins/tools/tool_transform2/KisAnimatedTransformMaskParamsHolder.cpp
M  +2    -0    plugins/tools/tool_transform2/KisAnimatedTransformMaskParamsHolder.h
M  +2    -2    plugins/tools/tool_transform2/kis_transform_mask_adapter.cpp
M  +1    -1    plugins/tools/tool_transform2/kis_transform_mask_adapter.h
M  +8    -4    plugins/tools/tool_transform2/kis_transform_utils.cpp
M  +2    -1    plugins/tools/tool_transform2/kis_transform_utils.h
M  +5    -0    sdk/tests/KisDumbAnimatedTransformMaskParamsHolder.cpp
M  +2    -0    sdk/tests/KisDumbAnimatedTransformMaskParamsHolder.h
M  +2    -1    sdk/tests/KisDumbTransformMaskParams.cpp
M  +1    -1    sdk/tests/KisDumbTransformMaskParams.h

https://invent.kde.org/graphics/krita/-/commit/10d1ef8f65115c9fd85eac7d5bea644ccd1af023