Bug 366419 - Group layer with gaussian blur filter mask gets divided into squares
Summary: Group layer with gaussian blur filter mask gets divided into squares
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filters (show other bugs)
Version: 3.0
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL: http://oi67.tinypic.com/2jahqwz.jpg
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-04 18:59 UTC by kalia24
Modified: 2019-05-09 14:18 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
source .kra file (836.62 KB, image/krita_file)
2016-08-16 19:11 UTC, kalia24
Details
exported .png file (195.23 KB, image/png)
2016-08-16 19:12 UTC, kalia24
Details

Note You need to log in before you can comment on or make changes to this bug.
Description kalia24 2016-08-04 18:59:01 UTC
Best to describe with picture:
http://oi67.tinypic.com/2jahqwz.jpg

Basically the image has it's layers divided in two layer groups: background (red and cyan) with filter mask applied to it and foreground (all others) + one layer "free" under them (semitransparent black) also with mask.
As u can see, there's nothing wrong with the foreground group, but the background gets divided into these strange segments. They are not regular and appear in different patterns.
Also nothing goes wrong when filter mask is applied to single layer.

Happens only after saving and reopening the file. It's enough to hide and unhide the group with the filter to make the artefacts disappear, but they will be there still when u open the file again.

Happened to me for all (two) files created with Krita 3.0 so far.

Reproducible: Always

Steps to Reproduce:
1. Create image with a group layer with gaussian blur mask applied to it.
2. Save and close file.
3. Reopen file.

Actual Results:  
The group layer with gaussian mask is divided into segments.

Expected Results:  
The layer should be evenly blurred.
Comment 1 Halla Rempt 2016-08-12 11:14:06 UTC
Hi,

Thanks for your report. Could you attach a file that shows the issue? I haven't been able to reproduce. If the file is too big, please mail it directly to me.
Comment 2 kalia24 2016-08-16 19:11:37 UTC
Created attachment 100630 [details]
source .kra file
Comment 3 kalia24 2016-08-16 19:12:33 UTC
Created attachment 100632 [details]
exported .png file
Comment 4 kalia24 2016-08-16 19:13:00 UTC
Attached both source KRA file and exported PNG.
Comment 5 Halla Rempt 2016-08-18 06:35:53 UTC
Thanks!
Comment 6 Halla Rempt 2016-11-01 11:54:33 UTC
Interestingly, toggling the filter mask's visibilty "fixes" the artefacts.
Comment 7 kalia24 2016-11-01 16:12:58 UTC
Yup, it seems that it's just the calculations for saved filter are wrong - when it's calculated again (after toggling the filter), the artefacts are gone... until reopening the file.
Comment 8 Nicholas Killewald 2018-03-27 19:03:07 UTC
I just tested this on Krita 4.0.0.  While the problem still exists when viewing the image in Krita itself, it seems like the artifacts don't show up when exporting to PNG anymore.  I suppose this is probably related to why it takes so much longer to export in 4.0.0 (it looks as if it's fully re-rendering the entire image on export, which is good).  So it might be mitigated as far as export is concerned, but not on the Krita canvas.
Comment 9 Dmitry Kazakov 2019-05-08 08:43:06 UTC
The problem happens because of the way how we do initial canvas update after loading the image. This update doesn't take masks change/need rects, therefore borders appear.

The problem can be reproduced only with operations that use KisFullRefreshWalker (we have only few of them).
Comment 10 Dmitry Kazakov 2019-05-09 14:18:42 UTC
Git commit 9d2920f896c0342774cacd95d4f8a4c5c9f58329 by Dmitry Kazakov.
Committed on 09/05/2019 at 14:17.
Pushed by dkazakov into branch 'master'.

Fix rendering of masks and layer styles on dependent nodes

In Krita we have two [0] types of "dependent" nodes, that is,
whose contents depends on the result of a merge of other layers.

KisAdjustmentLayer depends on the result of composing all the
layer below it. KisGroupLayer depends on the result of composing
its children.

All these layers can have filter masks and/or layer styles. To
handle them, the patch introduces a term needRectForOriginal().
needRectForOriginal(rect) means "what area of layer's original
device should be prepared to correct result in 'rect' of the
'final device'". Under 'final device' it may be considered
projection for a layer or a final composed planes for a
projection plane.

What is the difference between needRectForOriginal() and needRect?

needRect() defines "what area of layers below should be prepared
to get correctly merged image". Obviously, group layer doesn't
depend on layers below (it depends on its children) and adjustment
layer's needRect also includes filter's needRect, which is not the
case for needRectForOriginal().

[1] --- actually, we have three. KisCloneLayer is also "dependent",
        but it is not covered by this patch.
Related: bug 390299

M  +5    -0    libs/image/kis_abstract_projection_plane.cpp
M  +8    -0    libs/image/kis_abstract_projection_plane.h
M  +4    -1    libs/image/kis_adjustment_layer.cc
M  +5    -2    libs/image/kis_async_merger.cpp
M  +23   -2    libs/image/kis_base_rects_walker.h
M  +17   -0    libs/image/kis_layer.cc
M  +15   -0    libs/image/kis_layer.h
M  +5    -0    libs/image/kis_layer_projection_plane.cpp
M  +1    -0    libs/image/kis_layer_projection_plane.h
M  +5    -0    libs/image/kis_mask_projection_plane.cpp
M  +1    -0    libs/image/kis_mask_projection_plane.h
M  +5    -0    libs/image/layerstyles/kis_layer_style_filter_projection_plane.cpp
M  +1    -0    libs/image/layerstyles/kis_layer_style_filter_projection_plane.h
M  +44   -18   libs/image/layerstyles/kis_layer_style_projection_plane.cpp
M  +3    -0    libs/image/layerstyles/kis_layer_style_projection_plane.h
A  +-    --    libs/image/tests/data/async_merger_test/dependent_adj_mask.png
A  +-    --    libs/image/tests/data/async_merger_test/dependent_adj_style.png
A  +-    --    libs/image/tests/data/async_merger_test/dependent_group_mask.png
A  +-    --    libs/image/tests/data/async_merger_test/dependent_group_mask_style.png
A  +-    --    libs/image/tests/data/async_merger_test/dependent_group_style.png
M  +160  -0    libs/image/tests/kis_async_merger_test.cpp
M  +7    -0    libs/image/tests/kis_async_merger_test.h
M  +3    -2    libs/image/tests/kis_walkers_test.cpp

https://invent.kde.org/kde/krita/commit/9d2920f896c0342774cacd95d4f8a4c5c9f58329