POV-Ray : Newsgroups : povray.advanced-users : Help please: eval_pigment rgb expression to float Server Time
29 Jul 2024 10:32:15 EDT (-0400)
  Help please: eval_pigment rgb expression to float (Message 1 to 5 of 5)  
From: Andrew Cocker
Subject: Help please: eval_pigment rgb expression to float
Date: 16 Aug 2002 11:43:05
Message: <3d5d1d89$1@news.povray.org>
Hi,

I'm trying to vary the size of each sphere in a 100x100 grid by sampling a bozo
pigment. I
haven't used eval_pigment before and I'm finding that it is returning a color
expression, and
I require a float, but I cannot work out how to convert between the two. I am
requiring a
float in the range 0..1.

Here's my code:

#declare MyPigment =
pigment {
bozo
scale 100
color_map {
[0 rgb 0]
[1 rgb 1]
}
}

union {

#declare LR=1;
#while (LR<=100)
   #declare IO=1;
   #while (IO<=100)
   #local Radi = eval_pigment (MyPigment,<LR,0,IO>);
   sphere {<0,0,0>,Radi translate <LR-50,0,IO-50> pigment {rgb <1,1,0>}}
   #declare IO=IO+1;
   #end
#declare LR=LR+1;
#end

}

All the best,

Andy Cocker


Post a reply to this message

From: ABX
Subject: Re: Help please: eval_pigment rgb expression to float
Date: 16 Aug 2002 11:45:53
Message: <3d7qlu0r7p11kgk4h2169m84434m5dj70a@4ax.com>
On Fri, 16 Aug 2002 16:43:09 +0100, "Andrew Cocker" <mai### [at] mariner9net> wrote:
> Hi,
>
> I'm trying to vary the size of each sphere in a 100x100 grid by sampling a bozo
pigment.

#declare Sampling=function{pattern{bozo}};

#declare Float=Sampling(0,0,0);

ABX


Post a reply to this message

From: Marc-Hendrik Bremer
Subject: Re: Help please: eval_pigment rgb expression to float
Date: 16 Aug 2002 11:48:04
Message: <3d5d1eb4@news.povray.org>
"Andrew Cocker" <mai### [at] mariner9net> schrieb im Newsbeitrag
news:3d5d1d89$1@news.povray.org...
> Hi,
>
> I'm trying to vary the size of each sphere in a 100x100 grid by sampling a
bozo pigment. I
> haven't used eval_pigment before and I'm finding that it is returning a
color expression, and
> I require a float, but I cannot work out how to convert between the two. I
am requiring a
> float in the range 0..1.
>
> Here's my code:
>
> #declare MyPigment =
> pigment {
> bozo
> scale 100
> color_map {
> [0 rgb 0]
> [1 rgb 1]
> }
> }

Well, the evaluated colorvector is 'grayscale', so you can use any component
of the vector you want. Perhaps use

Radi.x?

Hth,

Marc-Hendrik


Post a reply to this message

From: Andrew Cocker
Subject: Re: Help please: eval_pigment rgb expression to float
Date: 16 Aug 2002 11:52:55
Message: <3d5d1fd7$1@news.povray.org>
"Marc-Hendrik Bremer" <Mar### [at] t-onlinede> wrote in message
news:3d5d1eb4@news.povray.org...
> Well, the evaluated colorvector is 'grayscale', so you can use any component
> of the vector you want. Perhaps use
>
> Radi.x?
>

Doh! Yes, of course. Works perfectly, thanks.

Andy


Post a reply to this message

From: Andrew Cocker
Subject: Re: Help please: eval_pigment rgb expression to float
Date: 17 Aug 2002 18:24:21
Message: <3d5ecd15$1@news.povray.org>
Thanks for this, ABX! As you may have read in another post of mine, I implemented your
suggestion, and parse time went from almost a minute to just 1 second. I'm happy :-)

One thing though: When I use pattern in the function, it returns a float. However,
when I use
pigment (which I think I have to do, as I need to  specify a color_map), I have to use
Marc-Hendrik's suggestion of Sampling.x. Still, it works, which is all that matters.

All the best,

Andy Cocker

"ABX" <abx### [at] babilonorg> wrote in message
news:3d7qlu0r7p11kgk4h2169m84434m5dj70a@4ax.com...
> On Fri, 16 Aug 2002 16:43:09 +0100, "Andrew Cocker" <mai### [at] mariner9net> wrote:
> > Hi,
> >
> > I'm trying to vary the size of each sphere in a 100x100 grid by sampling a bozo
pigment.
>
> #declare Sampling=function{pattern{bozo}};
>
> #declare Float=Sampling(0,0,0);
>
> ABX


Post a reply to this message

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