All Questions

Community

A
ThePirateKing
posted to: Gradient mapping

Greyscale Vector

Where does the `vec3(0.299, 0.587, 0.114)` vector come from, and why this vector with these specific coords?

  • Nathan Lovato replied

    This is a commonly used multiplier to convert to greyscale. I found it online and don't know the origin, which is probably really old.

    These multipliers and output colors just lead to perceptual greyscale - it certainly has to do with how RGB lights mix in your display.

    An alternative approach is to average out the three color channels, but I find it leads to dull results and wouldn't recommend it.

  • Razoric replied

    More detailed answer:

    R: 0.299, G: 0.587, B: 0.144 are the color coefficients of the CCIR 601 digital formats, one of the most common color standards currently in used for standard digital media in PAL and NTSC.

    As most graphics cards will output standard colors in that space (or something close to it), multiplying color by those coefficients leads to a nullification of color and a 'tone appropriate' grayscale.