[Bf-committers] Color to greyscale conversion - confusion

Troy Sobotka troy.sobotka at gmail.com
Fri Jun 22 19:39:31 CEST 2012


On Jun 22, 2012 10:34 AM, "Campbell Barton" <ideasman42 at gmail.com> wrote:
>
> Does anyone know why there are 2 different color -> grey-scale
> conversions in blenders code?
>
> float rgb_to_bw(const float rgb[3])
> {
>        return 0.35f * rgb[0] + 0.45f * rgb[1] + 0.2f * rgb[2];
> }
>
> float rgb_to_grayscale(const float rgb[3])
> {
>        return 0.3f * rgb[0] + 0.58f * rgb[1] + 0.12f * rgb[2];
> }
>
> >From reading the code its not clear why one of these are used over
another.

There is no singular method to achieve a conversion.

The second looks like an sRGB luminance model transformation.

With respect,
TJS


More information about the Bf-committers mailing list