POV-Ray : Newsgroups : povray.binaries.images : Re: Color question : Re: Color question Server Time
19 Nov 2024 18:04:14 EST (-0500)
  Re: Color question  
From: Mike Williams
Date: 24 Nov 2001 01:17:19
Message: <R4lTREAhsz$7Ewc3@econym.demon.co.uk>
Wasn't it JPGargoyle who wrote:
>Hi all!
>This is my very first post ever :))
>
>I am still a beginner so mabe this post might be somewere else. If that is
>the case, my apologies to all.
>Well, I was experimenting with PovRay 3.5 beta 7 and I was trying to get the
>"negative" of a color when I get some unexpected results (at lest to me :D).
>
>My question is: Is   rgb 1    the same as   rgb <1,1,1> ?

Technically, yes, but   1   isn't the same as    <1,1,1>.

The colour "1" is the same as <1,1,1,1,1>, but when you stick "rgb" at
the front it becomes <1,1,1,0,0>.


>pigment{color rgb 1} gives the same result as pigment{ color rgb <1,1,1>}
>but
>pigment{color rgb <1,1,1> - Gray25} gives the expected results and
>pigment{color rgb 1 - Gray25}results in something completely different.

What happens is that the expression "1 - Gray25" is expanded to 
   <1,1,1,1,1> - <0.25,0.25,0.25,0,0>
giving the result <0.75,0.75,0.75,1,1> instead of <0.75,0.75,0.75,0,0>

The following code can be used to see what happens with different colour
expressions.


#include "colors"
//#declare MyColour = White - Gray25;
//#declare MyColour = 1 - Gray25;
#declare MyColour = rgb 1 - Gray25;

#debug str(MyColour.red,0,2)
#debug ", "
#debug str(MyColour.green,0,2)
#debug ", "
#debug str(MyColour.blue,0,2)
#debug ", "
#debug str(MyColour.filter,0,2)
#debug ", "
#debug str(MyColour.transmit,0,2)
#debug "\n"


It could be argued that "rgb" should force the filter and transmit
values to zero, rather than just display the warning and accept non-zero
filters and/or transmits. (You did notice that you were getting the
warning "Suspicious expression after rgb.", didn't you?)


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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