POV-Ray : Newsgroups : povray.programming : Got the grey blues. Server Time
28 Jul 2024 16:22:59 EDT (-0400)
  Got the grey blues. (Message 1 to 6 of 6)  
From: Edward C 
Subject: Got the grey blues.
Date: 26 Aug 1999 00:14:24
Message: <37c4bf20@news.povray.org>
Looking through the source for a formula to convert RGB values to grey
values, I've discovered a number of slightly different formulas, none of
which will convert RGB <1,1,1> to a grey value of 1.  Perhaps there is some
good reason for this, perhaps not, but either way, does someone have a
formula that will convert in this manner?

Thought:  Perhaps a standard conversion function could be implimented in a
future version of POV and replace all those ugly and different formulas in
the code.


Post a reply to this message

From: Jon A  Cruz
Subject: Re: Got the grey blues.
Date: 26 Aug 1999 01:35:52
Message: <37C4D2D3.EC5EC16@geocities.com>
"Edward C." wrote:

> Looking through the source for a formula to convert RGB values to grey
> values, I've discovered a number of slightly different formulas, none of
> which will convert RGB <1,1,1> to a grey value of 1.  Perhaps there is some
> good reason for this, perhaps not, but either way, does someone have a
> formula that will convert in this manner?
>
> Thought:  Perhaps a standard conversion function could be implimented in a
> future version of POV and replace all those ugly and different formulas in
> the code.

Have you checked Poynton's color FAQ?

http://www.inforamp.net/~poynton/ColorFAQ.html

--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


Post a reply to this message

From: Nieminen Juha
Subject: Re: Got the grey blues.
Date: 26 Aug 1999 03:51:21
Message: <37c4f1f9@news.povray.org>
Edward C. <edw### [at] hotmailcom> wrote:
: Looking through the source for a formula to convert RGB values to grey
: values, I've discovered a number of slightly different formulas, none of
: which will convert RGB <1,1,1> to a grey value of 1.

  Are you sure? The weights for the color components are calculated with:

0.2125*R + 0.7154*G + 0.0721*B

  If we substitute R, G and B with 1's, we get exactly 1.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Nathan Kopp
Subject: Re: Got the grey blues.
Date: 26 Aug 1999 23:31:46
Message: <37C60728.A57B363B@Kopp.com>
"Edward C." wrote:
> 
> Looking through the source for a formula to convert RGB values to grey
> values, I've discovered a number of slightly different formulas, none of
> which will convert RGB <1,1,1> to a grey value of 1.  Perhaps there is some
> good reason for this, perhaps not, but either way, does someone have a
> formula that will convert in this manner?

There are two that I have seen in POV:
  0.2125*R + 0.7154*G + 0.0721*B (as mentioned by Nieminen)
and
  (R+G+B)/3.0

I agree that it should be standardized (with a macro or inline function)
in the future.

-Nathan


Post a reply to this message

From: Edward C 
Subject: Re: Got the grey blues.
Date: 27 Aug 1999 01:54:57
Message: <37c62831@news.povray.org>
Nieminen Juha wrote in message <37c4f1f9@news.povray.org>...
>  Are you sure? The weights for the color components are calculated with:
>
>0.2125*R + 0.7154*G + 0.0721*B
>
>  If we substitute R, G and B with 1's, we get exactly 1.


I haven't seen that particular formula.  I have seen in the code:
0.287R+0.589G+0.144B which gives 0.990 with 1,1,1
0.229R+0.589G+0.144B -> 0.930
And one which does work:
0.30R+0.59G+0.11B -> 1.00


Post a reply to this message

From: Nathan Kopp
Subject: Re: Got the grey blues.
Date: 28 Aug 1999 17:38:28
Message: <37C85750.3707AC0A@Kopp.com>
"Edward C." wrote:
> 
> Nieminen Juha wrote in message <37c4f1f9@news.povray.org>...
> >  Are you sure? The weights for the color components are calculated with:
> >
> >0.2125*R + 0.7154*G + 0.0721*B
> >
> >  If we substitute R, G and B with 1's, we get exactly 1.
> 
> I haven't seen that particular formula.  I have seen in the code:
> 0.287R+0.589G+0.144B which gives 0.990 with 1,1,1
> 0.229R+0.589G+0.144B -> 0.930
> And one which does work:
> 0.30R+0.59G+0.11B -> 1.00

Interesting.  I never really looked that closely at them and so I thought
they were all the same and were correct.  Strange.

-Nathan


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.