Bug 409620 - Plasma 5.16.2 Blur Noise Level Issue
Summary: Plasma 5.16.2 Blur Noise Level Issue
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: compositing (show other bugs)
Version: 5.16.2
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-08 14:48 UTC by duncanyoyo1
Modified: 2021-09-01 21:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Plasma 5.16.2 Blur Noise Levels Comparison (1.23 MB, image/png)
2019-07-08 14:48 UTC, duncanyoyo1
Details
Konsole on Pure Black Background Level 6/15 (201.83 KB, image/png)
2019-07-08 14:51 UTC, duncanyoyo1
Details
Konsole Blur Level 15 (599.36 KB, image/png)
2019-07-08 20:57 UTC, duncanyoyo1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description duncanyoyo1 2019-07-08 14:48:19 UTC
Created attachment 121385 [details]
Plasma 5.16.2 Blur Noise Levels Comparison

SUMMARY
After updating to Plasma 5.16 the noise that is added to the blur was broken for me.

Setting the slider to level 1 or 2 produces no noise, and level 2 is brighter than level 1. Setting to level 3 or higher makes the noise stand out too much.

On Plasma 5.15 I had the Noise strength set to about 6/15. Now on Plasma 5.16 it is set at 3/15 and the noise is more visible than it was at 6/15 on Plasma 5.15. Setting it to 2/15 seems to remove the noise entirely.

STEPS TO REPRODUCE
1. Update to Plasma 5.16
2. Use nvidia graphics (Maybe)
3. Change Noise Strength in Desktop Behavior > Desktop Effects > Blur to 1/15, 2/15, 3/15, etc.

OBSERVED RESULT
See that level 1 and 2 produce no noise, and level 3+ produces noise stronger than on Plasma 5.15 at level 6. Level 15 on Plasma 5.16 is like looking at white noise.

EXPECTED RESULT
Level 1 to have no noise, and level 2+ to have increasingly stronger noise up to level 15.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kernel 5.1.16.arch1-1, Plasma 5.16.2
KDE Plasma Version: 5.16.2
KDE Frameworks Version: 5.59.0
Qt Version: 5.13

ADDITIONAL INFORMATION

I have attached a screenshot of my Konsole with various Noise levels on Plasma 5.15 and 5.16.

Maybe the abs() function is not working as expected? 
Before  |  After
----------------
   100     95     (substracted normally)
    10      5     (substracted normally)
     8      3     (substracted normally)
     5      0     (substracted normally)
     4      1     (4 - 5 = -1 ---> abs(-1) = 1)
     2      3     (3 - 5 = -3 ---> abs(-3) = 3)
     0      5     (0 - 5 = -5 ---> abs(-5) = 5)

It seems like after this commit (https://phabricator.kde.org/R108:168109f3bb36882cdd1f18ebe3ce052e4cd608a0) it has been like this, but I am not sure if it is related.

You can compare my screenshots to that of when the Blur Noise was implemented and see that something is not right. https://phabricator.kde.org/D10281
Comment 1 duncanyoyo1 2019-07-08 14:51:35 UTC
Created attachment 121386 [details]
Konsole on Pure Black Background Level 6/15
Comment 2 Vlad Zahorodnii 2019-07-08 18:17:36 UTC
(In reply to duncanyoyo1 from comment #0)
> It seems like after this commit
> (https://phabricator.kde.org/R108:168109f3bb36882cdd1f18ebe3ce052e4cd608a0)
> it has been like this, but I am not sure if it is related.
As an author of that commit I assure that it has nothing to do with this bug. If you look closely, that commit was part of KWin since 5.14.

This "bug" is most likely caused by the sRGB patch (the one that made the blur effect more "natural").
Comment 3 Vlad Zahorodnii 2019-07-08 18:19:20 UTC
s/assure/assure you/
Comment 4 duncanyoyo1 2019-07-08 20:56:23 UTC
Vlad, thank you for the quick reply.

I think something needs to be changed, because over a dark background the noise stands out too much now. It looks fine with a light background.

Before it looked great with light or dark behind the window.

The noise looks quite a bit different from when the noise was implemented. Look at level 15/15 from when the noise was added. And now look at level 15.

Maybe a small change to how the values are calculated when the background is dark to make the noise slightly darker? Seems like it is being lightened too much currently.

I think since the sRGB change the noise levels need an adjustment.

I really like the noise itself, I think it makes a big difference in the look and feel of Plasma.
Comment 5 duncanyoyo1 2019-07-08 20:57:07 UTC
Created attachment 121402 [details]
Konsole Blur Level 15
Comment 6 duncanyoyo1 2019-07-10 15:02:55 UTC
As of 5.16.3 this seems to be fixed.

Thanks everyone!
Comment 7 David Edmundson 2021-09-01 21:50:29 UTC
Git commit c193efc96239f1a0611206708b84dba2d7befdaa by David Edmundson, on behalf of Tatsuyuki Ishi.
Committed on 01/09/2021 at 21:42.
Pushed by davidedmundson into branch 'master'.

blur: add noise in perceptual space

The previous implementation added noise in linear space, which resulted in
the effect becoming more pronounced on black backgrounds. This patch
changes the process to be applied in perceptual space, by making the noise
addition pass a separate draw call and disabling GL_FRAMEBUFFER_SRGB during
that.

After this change, noise will look much more suppressed and almost never
grainy. This change also changes the range of the noise from
[-strength..strength) to [0..strength), as blending can only be either
additive or subtractive. As a result, users might need to ramp up their
noise parameter after this change.

v2: Add more explanation around the draw call.
v3: Fix noise not fading out with the fade out effect.
v4: Restore an accidentally removed comment.
v5: Add CCBUG.
v6: Rebase.
v7: Fix a formatting issue.

M  +39   -15   src/effects/blur/blur.cpp
M  +1    -0    src/effects/blur/blur.h
M  +5    -20   src/effects/blur/blurshader.cpp

https://invent.kde.org/plasma/kwin/commit/c193efc96239f1a0611206708b84dba2d7befdaa