Bug 463585 - Visible banding with gradient map filter, even on high bit depth canvas
Summary: Visible banding with gradient map filter, even on high bit depth canvas
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Filter Layers (show other bugs)
Version: 5.1.4
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-29 12:20 UTC by Kampidh
Modified: 2023-01-05 09:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Visible banding on gradient after the filter is applied (137.14 KB, image/png)
2022-12-29 12:20 UTC, Kampidh
Details
Original gradient before the filter is applied (126.95 KB, image/png)
2022-12-29 12:22 UTC, Kampidh
Details
Example krita document (593.69 KB, application/x-krita)
2022-12-29 12:24 UTC, Kampidh
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kampidh 2022-12-29 12:20:57 UTC
Created attachment 154877 [details]
Visible banding on gradient after the filter is applied

SUMMARY
Using Gradient Map filter (either from Filter > Map, or Filter Layer) produces a visible banding, even on a higher bit depth canvas (16bpc). Segment and Stop gradient produces the same result.


STEPS TO REPRODUCE
1. Create new document, preferably at 16bpc
2. Create a simple gradient (eg. Black -> White)
3. Add Gradient Map with a same gradient as before

OBSERVED RESULT
Visible banding occurred on the gradient (attached image)

EXPECTED RESULT
Gradient should be smooth, or at least as smooth as the original layer.

SOFTWARE/OS VERSIONS
Windows: 10 Pro 21H2
Qt Version: 5.12

ADDITIONAL INFORMATION
It seems like the Gradient Map filter is processed with 8-bit precision regardless of the canvas bit depth. This can be observed by picking up the color on the gradient. The original gradient have a smooth transition, while the filtered one will have a bigger steps.
Comment 1 Kampidh 2022-12-29 12:22:26 UTC
Created attachment 154878 [details]
Original gradient before the filter is applied
Comment 2 Kampidh 2022-12-29 12:24:57 UTC
Created attachment 154879 [details]
Example krita document

Try to toggle the Gradient Map filter layer on and off, then observe the gradient.
Comment 3 Halla Rempt 2023-01-04 10:53:44 UTC
Thank you for the report. I can confirm the issue.
Comment 4 Bug Janitor Service 2023-01-04 21:28:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1698
Comment 5 Invent Merge Service 2023-01-05 07:02:13 UTC
Git commit b9e615b1ff944c86b160232d9563570b511de3d1 by Merge Service, on behalf of Deif Lou.
Committed on 05/01/2023 at 07:01.
Pushed by merge-service into branch 'master'.

Fix issue with banding in the gradient map filter

Part-of: <https://invent.kde.org/graphics/krita/-/merge_requests/1698>

M  +16   -0    libs/pigment/KoColorSpace.h
M  +17   -1    libs/pigment/KoColorSpaceAbstract.h
M  +41   -0    plugins/color/lcms2engine/LcmsColorSpace.h
M  +12   -1    plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.cpp
M  +1    -0    plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h
M  +6    -6    plugins/filters/gradientmap/KisGradientMapFilter.cpp

https://invent.kde.org/graphics/krita/commit/b9e615b1ff944c86b160232d9563570b511de3d1
Comment 6 Halla Rempt 2023-01-05 09:04:51 UTC
Git commit 58794306157146e0a40658554569d0f44d11db26 by Halla Rempt, on behalf of Deif Lou.
Committed on 05/01/2023 at 09:04.
Pushed by rempt into branch 'krita/5.1'.

Fix issue with banding in the gradient map filter

Part-of: <https://invent.kde.org/graphics/krita/-/merge_requests/1698>
(cherry picked from commit b9e615b1ff944c86b160232d9563570b511de3d1)

M  +16   -0    libs/pigment/KoColorSpace.h
M  +17   -1    libs/pigment/KoColorSpaceAbstract.h
M  +41   -0    plugins/color/lcms2engine/LcmsColorSpace.h
M  +12   -1    plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.cpp
M  +1    -0    plugins/color/lcms2engine/colorspaces/rgb_u8/RgbU8ColorSpace.h
M  +6    -6    plugins/filters/gradientmap/KisGradientMapFilter.cpp

https://invent.kde.org/graphics/krita/commit/58794306157146e0a40658554569d0f44d11db26