Switch eye dropper to use linear color space internally

Authored by Stefan Werner (swerner) on Fri, Apr 7, 9:52 PM.



The eye dropper currently uses display space internally, which leads to subtle bugs.

For one, the accumulation function of the eye dropper is intended to return the average of the pixels that were sampled. This is operation is only correct when done in linear space, averaging colors in non-linear spaces (such as sRGB display space) will not return the correct result.

Second, the results of color picking from a Viewer node in the compositor returns a bit-by-bit precise result only when the display color space is set to "None". When the display color space is set to anything else, the color undergoes linear->display->linear conversions and loses precision. Bit precise color picking is important for certain matte operations, such as a full implementation of Cryptomatte (see D2106).

Attached is a patch that switches the internal color representation of the eye dropper from display space to linear. Any time a linear color is requested and the color is picked from a linear object, the result is now precise to the bit as the color gets patched through directly. Color space conversion now only happens when a color is picked from non-linear display space objects or when the color is requested to be returned in non-linear space.

In addition, this patch changes the DifferenceMatte node to interpret a tolerance of 0.0 to accept colors that are identical bit by bit, as apposed to simply refusing all colors. This way, one can create Mattes for an exact color in an image by picking a color from a Compositor Viewer, allowing the use of false color encoded ID mattes.

Diff Detail