Fix T58549, T56741: HSV color picker issues with Filmic view transform.

In 2d655d3 the color picker was changed to use display space HSV values.
This works ok for a simple sRGB EOTF, but fails with view transforms like
Filmic where display space V 1.0 maps to RGB 16.292.

Instead we now use the color_picking role from the OCIO config when
converting from RGB to HSV in the color picker. This role is set to sRGB
in the default OCIO config.

This color space fits the following requirements:

* It is approximately perceptually linear, so that the HSV numbers and
  the HSV cube/circle have an intuitive distribution.
* It has the same gamut as the scene linear color space.
* Color picking values 0..1 map to scene linear values in the 0..1 range,
  so that picked albedo values are energy conserving.
This commit is contained in:
2018-12-13 15:59:58 +01:00
parent 33993c056a
commit 6601a89650
9 changed files with 199 additions and 175 deletions

View File

@@ -2992,19 +2992,20 @@ uiBlock *UI_block_begin(const bContext *C, ARegion *region, const char *name, sh
block->evil_C = (void *)C; /* XXX */
if (scn) {
block->color_profile = true;
/* store display device name, don't lookup for transformations yet
* block could be used for non-color displays where looking up for transformation
* would slow down redraw, so only lookup for actual transform when it's indeed
* needed
*/
BLI_strncpy(block->display_device, scn->display_settings.display_device, sizeof(block->display_device));
STRNCPY(block->display_device, scn->display_settings.display_device);
/* copy to avoid crash when scene gets deleted with ui still open */
block->unit = MEM_mallocN(sizeof(scn->unit), "UI UnitSettings");
memcpy(block->unit, &scn->unit, sizeof(scn->unit));
}
else {
STRNCPY(block->display_device, IMB_colormanagement_display_get_default_name());
}
BLI_strncpy(block->name, name, sizeof(block->name));
@@ -3295,20 +3296,6 @@ void ui_block_cm_to_scene_linear_v3(uiBlock *block, float pixel[3])
IMB_colormanagement_display_to_scene_linear_v3(pixel, display);
}
void ui_block_cm_to_display_space_range(uiBlock *block, float *min, float *max)
{
struct ColorManagedDisplay *display = ui_block_cm_display_get(block);
float pixel[3];
copy_v3_fl(pixel, *min);
IMB_colormanagement_scene_linear_to_display_v3(pixel, display);
*min = min_fff(UNPACK3(pixel));
copy_v3_fl(pixel, *max);
IMB_colormanagement_scene_linear_to_display_v3(pixel, display);
*max = max_fff(UNPACK3(pixel));
}
static uiBut *ui_but_alloc(const eButType type)
{
switch (type) {