Search Unity

Grayscale formula used in Color.grayscale

Discussion in 'Documentation' started by Popiolek, Feb 28, 2018.

  1. Popiolek

    Popiolek

    Joined:
    Jan 26, 2016
    Posts:
    4
    Like the title suggests, I am looking for exact formula that Unity uses for grayscale values calculation
    i.e. this is typical luminosity formula 0.21 R + 0.72 G + 0.07 B. It provides similar yet not matching values.
    To be clear, I am just looking formula not a script or code.
     
  2. ryan_unity

    ryan_unity

    Unity Technologies

    Joined:
    Dec 28, 2014
    Posts:
    11
    Propagant and AlexTuduran like this.
  3. Popiolek

    Popiolek

    Joined:
    Jan 26, 2016
    Posts:
    4
    Hi Ryan
    Thank you for the answer. I just wanted to know which one you are using, it was not my intention to suggest a change.
    I am working on image modification library and I want to provide experience consistent with the Unity Color.grayscale.
    Cheers
     
  4. AlexTuduran

    AlexTuduran

    Joined:
    Nov 26, 2016
    Posts:
    27
    If your specific application requires that your implementation is energy conservative AND chromatically unbiased at the same time, use (R + G + B) / 3. Anything else is either not energy conservative or chromatically biased. Cheers.