From 1f8e9ad6de29021bf1a84d7133f665bd5bec8157 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Fri, 15 Apr 2022 09:24:28 +0200 Subject: Color management of brush colors --- source/blender/editors/sculpt_paint/sculpt_paint_image.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 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); -- cgit v1.2.3