Hi, all!
I’ve spent the last two weeks rewriting and fixing the blendmodes so that they would work correctly in Float16 and Float32 spaces. Before this patch, converting the image with non-trivial blendmodes (or layer styles) into F16/F32 color space could cause color artifacts (some pixels could randomly become extremely bright or completely black). That happened because of the unlimited nature of floating-point color spaces, so the color values could sometimes become negative or NaN or infinity. Now most of our blendmodes handle these corner cases correctly, so blending in an SDR image in F16/F32 color space should look exactly the same as in Integer8 or Integer16 color spaces.
Since this patch changes core parts of Krita, could you help me with testing the fixed (and new) modes?
What needs to be tested:
-
Check if changed blendmodes behave “in expected way” when used in SDR image in F16/F32 format:
- open any complicated Integer8 or Integer16 image (with complicated belndmodes)
- convert this image into Float16/Float32 space
- the image should look exactly the same as before without any dark or bright
pixels appearing
-
Check if the layers styles using blendmodes behave sane in Float32 images (e.g. Color Overlay and Texture Overlay)
-
Check if blendmodes work “in expected way” when used over the HDR image. They shouldn’t generate visible artifacts at least, and, ideally, they should do something useful

-
There are four new(!) HDR-specific blendmodes. I wonder if they are actually needed?
- The list of new modes:
- Color Dodge HDR
- Vivid Light HDR
- Hard Mix HDR
- Hard Overlay HDR
- Check how they behave when used on SDR and HDR images
- Does the result look useful, should be keep them?
- The list of new modes:
The general idea of the patch that most of our blendmodes are now SDR-preserving. That is, when applied to SDR image, they keep the image within SDR range. It should guarantee that SDR image can be processed in F16/F32 space and it will look exactly the same as if it was processed in Integer16 color space.
At the same time, many of the blendmodes (while preserving SDR values) can also handle HDR values in an “expected way”.
Changed blendmodes:
These three modes should now work as expected with both HDR and SDR values. HDR values should not be clamped, just scaled as the blendmode name suggests.
- Color Burn
- Linear Burn
- Pin Light
The following four new modes can make your image brighter that 1.0 (i.e. HDR):
- Color Dodge HDR
- Vivid Light HDR
- Hard Mix HDR
- Hard Overlay HDR
Do we actually need these special HDR modes?
The following four modes should clamp the value by 1.0 (i.e. keep SDR), which basically forces them to behave exactly as the corresponding modes in Integer16 color space.
- Color Dodge
- Vivid Light
- Hard Mix
- Hard Overlay
These blend modes were changed in the patch and should just behave “sane” in both SDR and HDR modes:
- Inverse Substract
- Exclusion
- Hard Light (aka Overlay)
- Soft Light (Photoshop)
- Soft Light (SVG)
- Parallel, Equivalence, GrainMerge, GrainExtract, Hard Mix Photoshop, Hard Mix Photoshop Softer – just clamp everything to SDR space, process and clamp to SDR again
There are a few changes in other rarely used blendmodes, but I don’t think they are supposed to be used on HDR images.
Windows package: krita-x64-5.3.0-prealpha-97e1d205.zip — Яндекс Диск
Linux package: krita-5.3.0-prealpha-97e1d2059e-x86_64.AppImage — Яндекс Диск
Merge request with some technical details: Draft: Refactor our blendmodes to properly support HDR modes (!2294) · Merge requests · Graphics / Krita · GitLab
The full list of changed blendmodes grouped by their categories: Blendmode Categories ($3288) · Snippets · GitLab



















