POV-Ray : Newsgroups : povray.binaries.images : Re: Color question Server Time
17 Aug 2024 08:22:29 EDT (-0400)
  Re: Color question (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: JRG
Subject: Re: Color question
Date: 23 Nov 2001 19:46:59
Message: <3bfeee03$1@news.povray.org>
"JPGargoyle" <jpg### [at] clixpt> ha scritto nel messaggio
news:3bfee77c@news.povray.org...
> Hi all!
> This is my very first post ever :))

And it was a large one... :) Next time try to keep your posts within 200 kb.

> I am still a beginner so mabe this post might be somewere else. If that is
> the case, my apologies to all.

This is the right place.

> 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> ?

Short answer: yes.

> 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.

Maybe the parser wraps 1 - Gray25 together which doesn't make sense. If you
want to make the difference between two color vectors just write:
#declare White = rgb 1; // or rgb <1,1,1>
#declare Gray25 = rgb 0.25;
pigment {White - Gray25}

> Well, my question is: What is the difference between rgb 1 and rgb
<1,1,1>?

As I said there's no difference.

> PS: sorry for the English (I an Portuguese)

Your English is far better than mine, but you may want to know that there's
also an international group (povray.international) where you can post your
questions in Portuguese.

--
Jonathan.


Post a reply to this message

From: JPGargoyle
Subject: Re: Color question
Date: 23 Nov 2001 20:02:05
Message: <3bfef18d@news.povray.org>
Thank you very much :)

Sorry about the size of the post. That was something I don't even think
about :P (more concerned on posting my first post)
I will be more careful next time :)

I've realized how I can do it the right way.

What still puzzles me is why I got those results.

Best regards.

"JRG" <jrg### [at] hotmailcom> wrote in message
news:3bfeee03$1@news.povray.org...
> "JPGargoyle" <jpg### [at] clixpt> ha scritto nel messaggio
> news:3bfee77c@news.povray.org...
> > Hi all!
> > This is my very first post ever :))
>
> And it was a large one... :) Next time try to keep your posts within 200
kb.
>
> > I am still a beginner so mabe this post might be somewere else. If that
is
> > the case, my apologies to all.
>
> This is the right place.
>
> > 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> ?
>
> Short answer: yes.
>
> > 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.
>
> Maybe the parser wraps 1 - Gray25 together which doesn't make sense. If
you
> want to make the difference between two color vectors just write:
> #declare White = rgb 1; // or rgb <1,1,1>
> #declare Gray25 = rgb 0.25;
> pigment {White - Gray25}
>
> > Well, my question is: What is the difference between rgb 1 and rgb
> <1,1,1>?
>
> As I said there's no difference.
>
> > PS: sorry for the English (I an Portuguese)
>
> Your English is far better than mine, but you may want to know that
there's
> also an international group (povray.international) where you can post your
> questions in Portuguese.
>
> --
> Jonathan.
>
>


Post a reply to this message

From: marabou
Subject: Re: Color question
Date: 23 Nov 2001 20:14:30
Message: <3bfef476@news.povray.org>
one little hint from me:
cut the quotations if they do not really needed. i have heard there is 
someone outhere who has no cable-modem, dsl or a flatrate.
sorry, i was bored.


Post a reply to this message

From: JPGargoyle
Subject: Re: Color question
Date: 23 Nov 2001 20:29:28
Message: <3bfef7f8@news.povray.org>
Ok. No problem :)
Perfectly understandable.


Post a reply to this message

From: Mike Williams
Subject: Re: Color question
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

From: Hugo
Subject: Re: Color question
Date: 24 Nov 2001 08:17:13
Message: <3bff9dd9$1@news.povray.org>
Hi  JPGargoyle,

Welcome to the Povray newsgroups! To understand why  "rgb 1"  is the same as
"rgb <1,1,1>"  I'd like to say that it's a general rule in Pov, that you may
use this kind of short typing. It takes fewer keystrokes on the keyboard,
and sometimes it looks simpler on the screen when you have a lot of code.
This is the only reason. It makes things easier for you, but gives the same
result in Pov.

Pov always need 3 numbers for a color expression  <r, g, b>  but when it
finds only one, it copies that number into all 3 places. Similar with other
commands, such as "scale", "translate" and so on.. If you write "scale 2"
Pov will copy it into <2, 2, 2> because this is the only information you
have given.

You may use other shortcuts. For example  2*x   is the same as <2, 0, 0>
because you only put a number into the x direction.

I have never tried to write  1-Gray25  so I don't know why Pov says it's
suspicious. To me it looks fully okay. I think there is another reason for
this warning.. Once Pov said the same to me. It was because I used too many
shortcuts in one place, so Pov wasn't sure what I meant.. For example, when
you want to colorize an object, the full description would be "material
 texture { pigment { color rgb <1,1,1> } } }"  so you can be glad that Pov
accepts you only write "pigment { rgb 1 }".


Regards,
Hugo


Post a reply to this message

From: Bob H 
Subject: Re: Color question
Date: 24 Nov 2001 08:57:21
Message: <3bffa741@news.povray.org>
"Mike Williams" <mik### [at] nospamplease> wrote in message
news:R4lTREAhsz$7Ewc3@econym.demon.co.uk...
>
> #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?)

Wait a minute.  What's rgb 1 doing becoming rgbft 1 anyway.  Isn't this a
bug then?  I knew color 1 became rgbft 1 but with rgb specified this
shouldn't be happening, right?
I just checked further by making sure everything was a vector except that
lone 1 after the rgb and it still results in the same outcome.  That is,
filter 1 and transmit 1.

bob h


Post a reply to this message

From: JPGargoyle
Subject: Re: Color question
Date: 24 Nov 2001 10:18:05
Message: <3bffba2d@news.povray.org>
Thank you very much Mike.

That was very helpful.

I was thinking in terms of an array of 3 instead of an array of 5.


often neglect :)

I did notice the warning, but didn't know exacly what the consequences of
that might be.

Now I understand what has happened.


Best regards.


Post a reply to this message

From: Batronyx
Subject: Re: Color question
Date: 24 Nov 2001 12:46:35
Message: <3bffdcfb@news.povray.org>
"Bob H." <omn### [at] msncom> wrote in message news:3bffa741@news.povray.org...

> Wait a minute.  What's rgb 1 doing becoming rgbft 1 anyway.  Isn't this a
> bug then?  I knew color 1 became rgbft 1 but with rgb specified this
> shouldn't be happening, right?
> I just checked further by making sure everything was a vector except that
> lone 1 after the rgb and it still results in the same outcome.  That is,
> filter 1 and transmit 1.
>
> bob h
>

The 3-component vector gets promoted to a 5-component vector in order to do the
math.

Batronyx ^"^


Post a reply to this message

From: JPGargoyle
Subject: Re: Color question
Date: 24 Nov 2001 13:02:29
Message: <3bffe0b5@news.povray.org>
"Hugo" <hua### [at] post3teledk> wrote in message
news:3bff9dd9$1@news.povray.org...
> Hi  JPGargoyle,
>
> Welcome to the Povray newsgroups! To understand why  "rgb 1"  is the same
as...

Thank you very much Hugo :)

> ... texture { pigment { color rgb <1,1,1> } } }"  so you can be glad that
Pov
> accepts you only write "pigment { rgb 1 }".

The problem is that we sometimes assume that the values ommited are one
thing by default, and in fact they are other (or we don't havethe slightest
idea what they are) :)

Best Regards


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

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