 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"JPGargoyle" <jpg### [at] clix pt> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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] hotmail com> wrote in message
news:3bfeee03$1@news.povray.org...
> "JPGargoyle" <jpg### [at] clix pt> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Ok. No problem :)
Perfectly understandable.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Mike Williams" <mik### [at] nospam please> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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.
Your debug code was very helpfull too. (It´s a part of the PovRay language I
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bob H." <omn### [at] msn com> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Hugo" <hua### [at] post3 tele dk> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Wasn't it Bob H. who wrote:
>"Mike Williams" <mik### [at] nospam please> 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.
It doesn't. If you try "#declare MyColour = rgb 1" in the above code
you'll see it becomes <1,1,1,0,0>.
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Bob H." <omn### [at] msn com> wrote...
>
> 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?
Actually, "rgb 1" does not become <1,1,1,1,1>. It will become <1,1,1,0,0>.
However, "rgb 1" is NOT what we have here.
The issue is that the parser interprets "rgb 1 - Gray25" as
"rgb (1 - Gray25) "
which promotes to
"rgb (<1,1,1,1,1> - Gray25)"
which becomes
"rgb (<0.75,0.75,0.75,1,1>)"
and then the "rgb" gets ignored.
Instead you probably desired this:
"(rgb 1) - Gray25"
Unfortunately, the parser won't accept that second version (with the "rgb 1"
wrapped in parentheses) as I wrote it above, but there are plenty of other
ways to work around this quirk in the POV parser. Examples have been given
in previous replies.
-Nathan
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Nathan Kopp" <nat### [at] kopp com> wrote in message
news:3bffe2f5$1@news.povray.org...
>
> Actually, "rgb 1" does not become <1,1,1,1,1>. It will become
<1,1,1,0,0>.
> However, "rgb 1" is NOT what we have here.
>
> The issue is that the parser interprets "rgb 1 - Gray25" as
> "rgb (1 - Gray25) "
> which promotes to
> "rgb (<1,1,1,1,1> - Gray25)"
> which becomes
> "rgb (<0.75,0.75,0.75,1,1>)"
> and then the "rgb" gets ignored.
>
> Instead you probably desired this:
> "(rgb 1) - Gray25"
>
> Unfortunately, the parser won't accept that second version (with the "rgb
1"
> wrapped in parentheses) as I wrote it above, but there are plenty of other
> ways to work around this quirk in the POV parser. Examples have been
given
> in previous replies.
Yes, but when I was checking on this I made Gray25 in the colors.inc deal
only with 3 float vectors instead of what had been there previously, which
was rgb 1 as well for White. White was then made into Gray25 by doing
Gray25=White*0.25. I made that be <0.25,0.25,0.25>, so in theory all were 3
float vectors until the final rgb 1 - Gray25 was done. What you're saying
then would mean even then the rgb 1 gets changed into <1,1,1,1,1> once the
math on it exists. I can't see that as being correct.
rgb 1 - <1,1,1,0,0>*<.25,.25,.25,0,0> = <.75,.75,.75,1,1>
How can that be right?
--
text{ttf"arial","bob h",.1,0pigment{rgb 9}translate<-1,-.2,3>}
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
bob h schrieb in Nachricht <3c005a27@news.povray.org>...
>rgb 1 - <1,1,1,0,0>*<.25,.25,.25,0,0> = <.75,.75,.75,1,1>
Why not? As the multiplication is prior to the subtraction you get
<1,1,1,1,1> - <0.25,0.25,0.25,0,0> which gives you the result you mentioned.
Marc-Hendrik
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Well, my point about this is how rgb ought to prevent rgbft from being used.
I can see how your logic would work were there no "rgb" but its presence
should mean anything following it is a 3 float vector. And even though my
example had all 5 it still does the promotion to 5 when all are only 3. The
filter and transmit keywords should be what is needed to get back to all 5
again from that rgb color value.
That's my reasoning anyway.
What you've said is essentially that a <red,green,blue,filter,transmit> is
omnipresent regardless of choosing to use rgb alone. Again, I can see that
being likely once using the 5 floats vector afterward but they are set to
zero. 1-0=1 but only if rgb 1 = rgbft 1.
Hope I'm not losing you, Mike Williams had said the same thing really.
--
text{ttf"arial","bob h",.1,0pigment{rgb 9}translate<-1,-.2,3>}
"Marc-Hendrik Bremer" <Mar### [at] t-online de> wrote in message
news:3c00ba66$1@news.povray.org...
>
> bob h schrieb in Nachricht <3c005a27@news.povray.org>...
>
> >rgb 1 - <1,1,1,0,0>*<.25,.25,.25,0,0> = <.75,.75,.75,1,1>
>
>
> Why not? As the multiplication is prior to the subtraction you get
> <1,1,1,1,1> - <0.25,0.25,0.25,0,0> which gives you the result you
mentioned.
>
> Marc-Hendrik
>
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
bob h schrieb in Nachricht <3c00c089@news.povray.org>...
>What you've said is essentially that a <red,green,blue,filter,transmit> is
>omnipresent regardless of choosing to use rgb alone. Again, I can see that
>being likely once using the 5 floats vector afterward but they are set to
>zero. 1-0=1 but only if rgb 1 = rgbft 1.
>
>Hope I'm not losing you, Mike Williams had said the same thing really.
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)?
Marc-Hendrik
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Marc-Hendrik Bremer" <Mar### [at] t-online de> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
> 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.)
Outlook express shows such posts as new ones so probably many of us notice
your reply. :o)
Hugo
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Hmmm.
These little details can be real tricky, and lead to some unexpected results
(like what happened to me) and be hard to figure what was wrong.
But now I am aware of them he he he :))
Thnxs Nathan
Best regards
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |