[Bf-committers] Color to greyscale conversion - confusion

Campbell Barton ideasman42 at gmail.com
Sat Jun 23 13:01:01 CEST 2012


Some interesting replies though it looks like we are no closer to an
answer, of course there is no right way - but I was hoping the
different ways blender does rgb->bw conversion could be named and
commented so developers know which to use and why.

At the moment my impression is early on developers just put in
whatever they read would work, or copied and pasted from existing
code.

Speculation from looking at the usages...

- Texture and shading pipeline use rgb_to_bw() which treat RGB more
evenly which might be better for shading when very un-even influences
for RGB channels could be problematic for shading with textures of
different colors (rgb_to_bw)

- Where as with compositing - perceptual rgb->bw is much more
important (rgb_to_grayscale)


On Sat, Jun 23, 2012 at 9:05 AM, Jeroen Bakker <j.bakker at atmind.nl> wrote:
> Hi
>
> Well as already said, there is no correct formula. Also if you think
> about what the method does it is basically two things:
>
> 1. mimic black and white conversion by multiplying the color channels
> with a certain value. Enhancing a light-channel to influence the BW more.
> nR = nG = nB = 0.2126 R + 0.7152 G + 0.0722 B
> 2. do a conversion to an undefined color space. (if you may call it a
> color space)
> Value = (nR+nG+nB)/3 // as nR NG & nB are same, we can optimize to value=nR
>
> There are many aperature plugins only to mimic black and white
> conversion (silver efex pro) in case for the compositor. But Campbell
> has a point that we don't have a clue when to use which and why. There
> are to many assumptions that is not clear in the method name.
>
> Luminance is chosen as it works best in most cases.
> see here comparison between the different algoritms
> http://www.tannerhelland.com/3643/grayscale-image-algorithm-vb6/
>
> "A full discussion of which formula is “better” is beyond the scope of
> this article. For further reading, I strongly suggest the work of
> Charles Poynton <http://poynton.com/>. For 99% of programmers, the
> difference between these two formulas is irrelevant."
> - But we are the 1% right :) -
> Jeroen.
>
>
> On 06/23/2012 04:27 AM, Troy Sobotka wrote:
>> On Jun 22, 2012 11:56 AM, "CoDEmanX" <codemanx
>> <codemanx at gmx.de>@<codemanx at gmx.de>
>> gmx.de <codemanx at gmx.de>> wrote:
>>> but correct seems to be:
>>>
>>> Y = 0.2126 R + 0.7152 G + 0.0722 B
>> Again, there is no singular "correct".
>>
>> I believe the above is a luminance based conversion from linearized sRGB.
>>
>> With respect,
>> TJS
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
>
>
> --
>
> Met vriendelijke groet,
>
> Jeroen Bakker
>
> *At Mind BV
> *
>
> Telefoon: 06 50 611 262
> E-mail: j.bakker at atmind.nl <mailto:j.bakker at atmind.nl>
>
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers



-- 
- Campbell


More information about the Bf-committers mailing list