[Bf-blender-cvs] [1f8e9ad6de2] temp-T96710-pbvh-pixels: Color management of brush colors

Jeroen Bakker noreply at git.blender.org
Fri Apr 15 11:51:45 CEST 2022


Commit: 1f8e9ad6de29021bf1a84d7133f665bd5bec8157
Author: Jeroen Bakker
Date:   Fri Apr 15 09:24:28 2022 +0200
Branches: temp-T96710-pbvh-pixels
https://developer.blender.org/rB1f8e9ad6de29021bf1a84d7133f665bd5bec8157

Color management of brush colors

===================================================================

M	source/blender/editors/sculpt_paint/sculpt_paint_image.cc

===================================================================

diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
index 2ad4fc9172e..da8758b1f20 100644
--- a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
+++ b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc
@@ -198,10 +198,15 @@ template<typename ImageBuffer> class PaintingKernel {
     copy_v3_v3(brush_color,
                ss->cache->invert ? BKE_brush_secondary_color_get(ss->scene, brush) :
                                    BKE_brush_color_get(ss->scene, brush));
+    /* NOTE: Brush colors are stored in sRGB. We use math color to follow other areas that
+     * use brush colors. From there on we use IMB_colormanagement to convert the brush color to the
+     * colorspace of the texture. This isn't ideal, but would need more refactoring to make sure
+     * that brush colors are stored in scene linear by default. */
+    srgb_to_linearrgb_v3_v3(brush_color, brush_color);
     brush_color[3] = 1.0f;
 
     const char *from_colorspace = IMB_colormanagement_role_colorspace_name_get(
-        COLOR_ROLE_COLOR_PICKING);
+        COLOR_ROLE_SCENE_LINEAR);
     ColormanageProcessor *cm_processor = IMB_colormanagement_colorspace_processor_new(
         from_colorspace, to_colorspace);
     IMB_colormanagement_processor_apply_v4(cm_processor, brush_color);



More information about the Bf-blender-cvs mailing list