 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hi,
groups:
How can I calculate the grey equivalent of a given rgb color?
Thanks,
Bonsai
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Bonsai wrote:
>
> Hi,
>
> groups:
>
> How can I calculate the grey equivalent of a given rgb color?
>
It's a bit hidden in the following thread:
Subject: checkered passed
Date: Tue, 14 Nov 2000 23:57:07 -0500
From: "Rick Mabry" <rma### [at] softdisk com>
Newsgroups: povray.general
Christoph
--
Christoph Hormann <chr### [at] gmx de>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3ac43695$1@news.povray.org>, "Bonsai" <bon### [at] b0n541 net>
wrote:
> groups:
>
> How can I calculate the grey equivalent of a given rgb color?
Try this macro:
#macro Grayscale(Color)
(0.297*Color.red + 0.589*Color.green + 0.114*Color.blue)
#end
This uses the same equation that POV uses internally.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> (0.297*Color.red + 0.589*Color.green + 0.114*Color.blue)
> This uses the same equation that POV uses internally.
Where does POV use a RGB2Grey computation do ?
--
background{rgb 1}camera{location<1,5,-2>look_at 0}#macro
m(a,b,i)#local d=(b-a)
/8;#local
e=vcross(d,y);#if(i)m(a-e,a+e+2*d,i-1)m(a+e,a+2*d-e,i-1)m(a+3*d-e,a+e
+3*d,i-1)m(a+3*d-e,a+5*d-e,i-1)m(a+6*d-e,a+e+6*d,i-1)m(a+8*d-e,a+e+8*d
,i-1)#else
cylinder{a,b,vlength(d)/3 pigment{rgb 0}}#end#end m(-4*x,2*x,4) // Jan
Walzer
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Jan Walzer wrote:
>
> Where does POV use a RGB2Grey computation do ?
>
pigment_pattern and displace warp for example.
Christoph
--
Christoph Hormann <chr### [at] gmx de>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3ac73253@news.povray.org>, "Jan Walzer" <jan### [at] lzer net>
wrote:
> > (0.297*Color.red + 0.589*Color.green + 0.114*Color.blue)
> > This uses the same equation that POV uses internally.
>
> Where does POV use a RGB2Grey computation do ?
MegaPOV has a GRAYSCALE() macro in colour.h. I think this replaces the
use of many separate equations, sometimes completely different ones, in
the official version.
MegaPOV uses it for image_pattern, pigment functions, and a few other
things. It may be used as an estimate of the brightness of the color in
some places.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |