POV-Ray : Newsgroups : povray.binaries.images : Re: Color question : Re: Color question Server Time
17 Aug 2024 06:18:28 EDT (-0400)
  Re: Color question  
From: Nathan Kopp
Date: 18 Jan 2002 00:03:51
Message: <3c47acb7$1@news.povray.org>
"Marc-Hendrik Bremer" <Mar### [at] t-onlinede> wrote...
>
> It seems like being all about apples and pears.
>
>  #declare ThreeComps= <0,0,1>;
>  #declare MyColour = rgb 1-ThreeComps;
>
> evaluates to <1,1,0,0,0>.
>
> But
> #declare ThreeComps= rgb <0,0,1>;
> #declare MyColour = rgb 1-ThreeComps;
>
> evaluates to <1,1,0,1,1>.
>
> In the first case, the math is done with vectors of any kind. In the
second
> case it's done with color vectors which are always 5 component vectors.
> I agree however, that rgb Whatever should result in a 5 component vector
> with filter and transmit set to 0. Is there a reason why this is not the
> case (or why rgb is ignored as Nathan said)?

I'm sorry this reply is so late. (Probably nobody will read it because it is
in an ancient thread, but I'll post anyway.)

My original point still holds true.  the "rgb" is NOT ignored.  However, it
is applied AFTER doing the math, NOT BEFORE.  Also, the "rgb" keyword will
never decrease the number of components in an existing vector.  It only
defines how things should be expanded.  Therefore, the "rgb" keyword has no
effect in these situations.

POV interprets your first example as
    #declare MyColour = rgb (1-ThreeComps);
Substitution gives us this:
    #declare MyColour = rgb (1-<0,0,1>);
Because the highest dimensionality is 3 (ThreeComps is a three component
vector), POV expands this as:
    #declare MyColour = rgb (<1,1,1>-<0,0,1>);
Compute:
    #declare MyColour = rgb (<1,1,0>);
NOW we finally apply the "rgb" keyword, and it has no effect:
    MyColour = <1,1,0>

Here's the second example:
    #declare MyColour = rgb (1-ThreeComps);
Because ThreeComps is a COLOR, substitution gives us this:
    #declare MyColour = rgb (1-<0,0,1,0,0>);
Because the highest dimensionality is 5 (ThreeComps is a color), POV expands
everything to 5 components, like this:
    #declare MyColour = rgb (<1,1,1,1,1>-<0,0,1,0,0>);
Compute:
    #declare MyColour = rgb (<1,1,0,1,1>);
NOW we finally apply the "rgb" keyword, and it has no effect (because "rgb"
will not reduce the number of components):
    MyColour = <1,1,0,1,1>

-Nathan


Post a reply to this message

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