Search Unity

Bug Inconsistent Color Picker Behaviour + possible Bug (Linear Workflow / Gamma Workflow)

Discussion in 'General Graphics' started by Thygrrr, Mar 6, 2021.

  1. Thygrrr

    Thygrrr

    Joined:
    Sep 23, 2013
    Posts:
    700
    I noticed that the color pickers and inspector drawers (HDR and standard) have several inconsistent behaviours. I also believe either I misunderstand Linear color space after all these years, or something may be wrong with the pickers, too. :)

    This is not about colors being too bright. This is about how colors are represented and stored by the color pickers, and swatches.
    (even though the symptom is colors being counterintuitively bright)

    I am not sure how long it has been this way, but I am on URP using Unity 2021.1.0b10 (there's a good chance this has been around since earlier versions, eg since Unity 2018)

    In Linear workflow:
    - normal color picker input is accepted and interpreted as Gamma (e.g. #008000 will result in a 0/128/0/255 color, and the preview swatch shows it in gamma space, as well as the inspector field). For this example I use TextMeshPro.
    upload_2021-3-6_15-2-15.png

    But the color is actually interpreted as linear on use, resulting in too bright colors (classic linear color space "problem", but in this case, it's actually the color picker doing the wrong thing). So my textmesh ("this is not...") has a (significantly) wrong final color after rendering and conversion to gamma (by the display/renderer/driver). So what seems to have occurred was that the color as given by the picker was incorrectly linearized. (probably not linearized at all)

    upload_2021-3-6_15-10-33.png


    - HDR color picker input is taken and accepted (and also shown in swatch) as the gamma value, but the top preview and the inspector field show it interpreted as linear values. I literally just created the swatch and it looks the same as the sdr swatch, not like the color I am actually editing. (even though I would say the HDR preview is wrong, not the swatch)
    upload_2021-3-6_15-14-46.png

    - The final rendered color, however, is the same (but "wrong", too bright - as if gamma value had been wrongly treated as linear for both)

    upload_2021-3-6_15-28-33.png

    - Just for reference, gamma workflow output is consistent with the swatches and the normal color picker preview and inspector, but not the HDR picker and preview:
    upload_2021-3-6_15-25-47.png


    Expected behaviour / suggestion:
    - regardless of workflow, color pickers display their previews in gamma space (because our eyes / screens are in gamma space)
    - in Linear workflow, the stored colors are the linear values
    - in Gamma workflow, the stored colors are the gamma values
    - a fourth, "Linear" color mode should be added to the picker dropdown in Linear mode, which takes a float 0..1 for standard and an appropriately wider range for HDR color components. (also to alleviate the weirdness of the intensity field, which is out of scope for this thread, but boy is it weird)

    AND...
    - a HTML color code given to a color picker in Linear flow should be linearized (because it's in gamma by convention) on input / on use / on serialization (not sure what's appropriate - but the color values on the actual Object should be in linear space)

    OR...
    - as a simpler change (because these expectations would actually impact workflows of many people), perhaps adding "Gamma [0..255]" and "Gamma [0..1] color modes to the color pickers in Linear workflow may be a preferable solution; and that "Gamma" mode accepts html style color triplets, but linearizes them for the user.
     
    Last edited: Mar 6, 2021
  2. FurySven

    FurySven

    Joined:
    Jan 12, 2019
    Posts:
    5
    Any updates? That is really confusing...
     
  3. FurySven

    FurySven

    Joined:
    Jan 12, 2019
    Posts:
    5
  4. JDoe1

    JDoe1

    Joined:
    Mar 21, 2018
    Posts:
    9