POV-Ray : Newsgroups : povray.advanced-users : vlength( ) Server Time
30 Jul 2024 06:21:44 EDT (-0400)
  vlength( ) (Message 11 to 18 of 18)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Ron Parker
Subject: Re: vlength( )
Date: 12 Jun 2000 19:31:22
Message: <slrn8katie.7pu.ron.parker@linux.parkerr.fwi.com>
On Mon, 12 Jun 2000 15:40:32 -0700, SamuelT wrote:
>It's for the eval_pigment stuff I've been using. I needed to convert a color
>vector into a float value so I could use it for elevation. The best way I
>could think of doing this would be averaging the components of the color
>vector. I'm now using a macro instead of vlength, and it works great.

Use the NTSC conversion for rgb to luminance.  You should see some examples
of it in the POV source.  Two of them might even match. :)


-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: SamuelT
Subject: Re: vlength( )
Date: 12 Jun 2000 23:01:49
Message: <3945A4C5.517F61D8@aol.com>
What pov source? The actual code which makes POV-Ray?

Ron Parker wrote:

> On Mon, 12 Jun 2000 15:40:32 -0700, SamuelT wrote:
> >It's for the eval_pigment stuff I've been using. I needed to convert a color
> >vector into a float value so I could use it for elevation. The best way I
> >could think of doing this would be averaging the components of the color
> >vector. I'm now using a macro instead of vlength, and it works great.
>
> Use the NTSC conversion for rgb to luminance.  You should see some examples
> of it in the POV source.  Two of them might even match. :)
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.

--
Samuel Benge

E-Mail: STB### [at] aolcom

Visit my isosurface tutorial at http://members.aol.com/stbenge


Post a reply to this message

From: Warp
Subject: Re: vlength( )
Date: 13 Jun 2000 09:08:12
Message: <3946323c@news.povray.org>
SamuelT <STB### [at] aolcom> wrote:
: It's for the eval_pigment stuff I've been using. I needed to convert a color
: vector into a float value so I could use it for elevation.

  So in practice what you are trying to do is to convert a color to b/w
(ie. a brightness value).
  There's an exact formula on how each color component affects the brightness,
and I don't remember exactly the values, but this might be a good
approximation:

brightness = red*0.25 + green*0.6 + blue*0.15

-- 
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: Ron Parker
Subject: Re: vlength( )
Date: 13 Jun 2000 09:27:48
Message: <slrn8kcej1.8e5.ron.parker@linux.parkerr.fwi.com>
On Mon, 12 Jun 2000 20:04:37 -0700, SamuelT wrote:
>What pov source? The actual code which makes POV-Ray?

Yes.  For example, in png_pov.c you'll see:

color = (png_byte)floor((line_data[col][RED]*0.30 +
                         line_data[col][GREEN]*0.59 +
                         line_data[col][BLUE]*0.11) * 255.0);

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: SamuelT
Subject: Re: vlength( )
Date: 13 Jun 2000 12:36:08
Message: <394663CA.15F8EBC7@aol.com>
Ron posted this from the POV source at 6:30:

color = (png_byte)floor((line_data[col][RED]*0.30 +
                         line_data[col][GREEN]*0.59 +
                         line_data[col][BLUE]*0.11) * 255.0);


Perhaps I can use your idea+his values to make it work?


Warp wrote:

> SamuelT <STB### [at] aolcom> wrote:
> : It's for the eval_pigment stuff I've been using. I needed to convert a color
> : vector into a float value so I could use it for elevation.
>
>   So in practice what you are trying to do is to convert a color to b/w
> (ie. a brightness value).
>   There's an exact formula on how each color component affects the brightness,
> and I don't remember exactly the values, but this might be a good
> approximation:
>
> brightness = red*0.25 + green*0.6 + blue*0.15
>
> --
> 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: SamuelT
Subject: Re: vlength( )
Date: 13 Jun 2000 13:14:09
Message: <39466CB5.8A7BD9A9@aol.com>
Well, this simple macro seems to be working. It is a combination of your idea and
Ron's pasted code.

#macro Lum( Color )
 Color.x*.3
 +Color.y*.59
 +Color.z*.11
#end

Funny thing, Photoshop's desaturation seems to be goofy. It gives unexpected
results, although the desaturation tool itself seems to be fine.


Warp wrote:

> SamuelT <STB### [at] aolcom> wrote:
> : It's for the eval_pigment stuff I've been using. I needed to convert a color
> : vector into a float value so I could use it for elevation.
>
>   So in practice what you are trying to do is to convert a color to b/w
> (ie. a brightness value).
>   There's an exact formula on how each color component affects the brightness,
> and I don't remember exactly the values, but this might be a good
> approximation:
>
> brightness = red*0.25 + green*0.6 + blue*0.15
>
> --
> 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: Warp
Subject: Re: vlength( )
Date: 14 Jun 2000 04:28:49
Message: <39474241@news.povray.org>
SamuelT <STB### [at] aolcom> wrote:
: color = (png_byte)floor((line_data[col][RED]*0.30 +
:                          line_data[col][GREEN]*0.59 +
:                          line_data[col][BLUE]*0.11) * 255.0);

: Perhaps I can use your idea+his values to make it work?

  It's not my idea. It's a commonly known equation.
  Using those values it would be:

brightness = red*0.3 + green*0.59 + blue*0.11

-- 
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: Tor Olav Kristensen
Subject: Re: vlength( )
Date: 16 Jun 2000 16:21:35
Message: <394A8C26.9378A1C8@online.no>
SamuelT wrote:
> 
> It's for the eval_pigment stuff I've been using. I needed to convert a color
> vector into a float value so I could use it for elevation. The best way I
> could think of doing this would be averaging the components of the color
> vector. I'm now using a macro instead of vlength, and it works great.


I see that Ron Parker and Warp already have suggested some conversion 
formulas for your problem.

Here are links to some more info about such formulas:


http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html
(Look at the end of item 5.2 - HSL, HSV)

(Rewritten html version of above page ?)
http://members.xoom.fr/scorpion/docs/txt/color_faq.html
(9.2 - Color look-up table to a gray scales)


http://www.inforamp.net/~poynton/notes/colour_and_gamma/ColorFAQ.html#RTFToC9


Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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