Bug 434938

Summary: Blur Filter Layers break on seams in Wrap Around Mode
Product: [Applications] krita Reporter: unfa <unfa00>
Component: Filter LayersAssignee: Krita Bugs <krita-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, dimula73, rmoerlandrj
Priority: NOR    
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Blur Layer doesn't work with Wrap Around Mode
gaps at borders
border discontinuities

Description unfa 2021-03-25 15:01:55 UTC
Created attachment 137058 [details]
Blur Layer doesn't work with Wrap Around Mode

SUMMARY

Filter Layers using Blur are not seamless, when using Wrap Ardoun Mode.

STEPS TO REPRODUCE
1. Create a new document from a 1K texture template
2. Enable Wrap Around Mode
3. Add a Gaussian Blur or Blur Filter Layer
4. Paint across the image border

OBSERVED RESULT

The Blur creates visible seams on the image border, breaking the wraparound effect.

EXPECTED RESULT

The blur should repeat seamlessly across image borders.


SOFTWARE/OS VERSIONS
Windows: -
macOS: -
Linux/KDE Plasma: Manjaro
(available in About System)
KDE Plasma Version:  5.12.3
KDE Frameworks Version: 5.80.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION

I know this was reported and supposedly fixed before, but I think it's a regression.
Comment 1 Ahab Greybeard 2021-04-01 07:19:52 UTC
Created attachment 137222 [details]
gaps at borders

I can confirm this for the Mar 30 5.0.0-prealpha (git 783e86c) appimage.

It happens for a filter layer and a filter mask.

When painting, there are obvious gaps at the border as show in the attachment 'gaps.png'

If Image -> Trim to Image Size is done or if the filter visibility is turned off then on again, the gaps become discontinuities as shown in the attachment 'discontinuities.png'.

The same effect is seen in the 4.3.0 and 4.4.0 appimages.
Comment 2 Ahab Greybeard 2021-04-01 07:20:41 UTC
Created attachment 137223 [details]
border discontinuities
Comment 3 Robert Moerland 2024-11-22 15:59:13 UTC
Reconfirmed with 5.2.6 and 5.30-alpha 3138bbd1 on Windows. Moreover, also induces a SAFE ASSERT, also without Filter Layer:
SAFE ASSERT (krita): "m_d->grid.contains(rc)" in file C:/builds/graphics/krita/libs/image/KisOverlayPaintDeviceWrapper.cpp, line 247
Comment 4 Dmitry Kazakov 2024-12-13 08:51:53 UTC
Git commit 6e79707c5df420bafa5e56bd7d047ba8e314c1ec by Dmitry Kazakov.
Committed on 13/12/2024 at 08:51.
Pushed by dkazakov into branch 'master'.

Fix artifacts when painting under a gaussian blus layer in WA-mode

Our filter layers and masks do not wrap-around their content. It is
done by-design. Because if they do,

1) Switching WA mode will have to regenerate the image projection, i.e.
   it will have to behave like "isolated mode", which causes issues
   on saving. Right now WA-mode is purely view-based transformation
   that doesn't influence how the image is rendered.

2) If we do wrapping for WA-mode, we'll also have to define it in some
   way for transformation masks and clone layers with offset. And it
   opens a rabbit hole. I have no idea how clone layers should behave in
   WA-mode :)

tldr; if you want to apply a gaussian blur filter in WA-mode, just apply
that using "Filter" menu. Only "image modification actions" do actually
support WA-mode. Layers know nothing about WA-mode.

M  +1    -1    libs/image/kis_convolution_painter.cc

https://invent.kde.org/graphics/krita/-/commit/6e79707c5df420bafa5e56bd7d047ba8e314c1ec
Comment 5 Dmitry Kazakov 2024-12-13 08:52:22 UTC
Git commit ebd8a65b6a89b39768984a7821c8aceaacff881b by Dmitry Kazakov.
Committed on 13/12/2024 at 08:52.
Pushed by dkazakov into branch 'krita/5.2'.

Fix artifacts when painting under a gaussian blus layer in WA-mode

Our filter layers and masks do not wrap-around their content. It is
done by-design. Because if they do,

1) Switching WA mode will have to regenerate the image projection, i.e.
   it will have to behave like "isolated mode", which causes issues
   on saving. Right now WA-mode is purely view-based transformation
   that doesn't influence how the image is rendered.

2) If we do wrapping for WA-mode, we'll also have to define it in some
   way for transformation masks and clone layers with offset. And it
   opens a rabbit hole. I have no idea how clone layers should behave in
   WA-mode :)

tldr; if you want to apply a gaussian blur filter in WA-mode, just apply
that using "Filter" menu. Only "image modification actions" do actually
support WA-mode. Layers know nothing about WA-mode.

M  +1    -1    libs/image/kis_convolution_painter.cc

https://invent.kde.org/graphics/krita/-/commit/ebd8a65b6a89b39768984a7821c8aceaacff881b
Comment 6 Dmitry Kazakov 2024-12-13 08:56:17 UTC
Hi, Unfa, Ahab and Robert!

I have fixed the transparent artifacs issue that Ahab reported but I decided not to make the Filter Layers todo seamless wraparound. We had had a short discussion on IRC and we decided that it would be too complicated for both, developers and users (since we'll have to also define WA-mode for clone layers and transform masks). 

Basically, if you would like to apply a seamless gaussian blur, then just apply it via Filter menu to a single layer or a flattened projection. The filter application is guaranteed to be seamless, but the filter layers and masks are not :)
Comment 7 Robert Moerland 2024-12-14 09:58:17 UTC
Thank you!