The color picker and brush->rgb values are in srgb, but sculpt vertex
colors works in linear, so they need to be converted.
Details
Diff Detail
- Repository
- rB Blender
Event Timeline
I am not sure about the part which states "The color picker ... in srgb," This depends on what exactly you mean by color picker's color space. Color picking has its own space, with conversions to/from scene linear IMB_colormanagement_scene_linear_to_color_picking_v3()/IMB_colormanagement_color_picking_to_scene_linear_v3(). If you are sampling window color using WM_window_pixel_sample_read() then the color is in display space, and to get scene linear you should be using IMB_colormanagement_display_to_scene_linear_v3().
Now, for the vertex colors be in linear space. I hope you mean it's in scene linear (or scene reference), otherwise it would have been step backwards to a hardcoded color profiles. If you know your input is indeed sRGB, you should be using IMB_colormanagement_srgb_to_scene_linear_v3().
It doesn't seem that this patch is correct from color management point of view.
| source/blender/editors/sculpt_paint/sculpt.c | ||
|---|---|---|
| 8138–8141 | The color_srgb should be float[3]. | |
| source/blender/editors/sculpt_paint/sculpt_paint_color.c | ||
| 135–138 | float brush_color[4]; srgb_to_linearrgb_v3_v3(brush_color, BKE_brush_color_get(ss->scene, brush)); brush_color[3] = 1.0f; Or you can even do: float brush_color[4] = {0.0f, 0.0f, 0.0f, 1.0f};
srgb_to_linearrgb_v3_v3(brush_color, BKE_brush_color_get(ss->scene, brush)); | |
Thx for this!
However, there is still the following issue:
Havent checked if both Vertex Colors and Sculpt Vertex Colors store in linear, if they both do, then it is probably not the fault of that operator, but sculptmode seems to display them differently from vertexpaint mode?
@Sergey Sharybin (sergey) Sorry, with the "color picker" I meant the UI widget with the color wheel that displays the color in the UI. I tried to use IMB_colormagement_srgb_to_scene_linear and it also seems to work fine, so I guess that the color UI widget and the rgb values stored in the painting tool are srgb. Is that the correct way to do it?
@Philipp Oeser (lichtwerk) As far as I know, legacy vertex colors are srgb, sculpt vertex colors are linear, so the operator to convert them should also do this conversion. I'll fix that on a separate patch.
Yes, the brush color is PROP_COLOR_GAMMA in RNA, which means it is sRGB rather than linear. If the color was linear it would have been PROP_COLOR.