|  |  | Doctor John <joh### [at] home com> wrote:
> I've just come across an unusual bit of behaviour when rendering a large
> number of similar isosurfaces.
> When I use the code:
> > #declare Index = 0;
> > #while (Index<29)
> >       isosurface {
> >               function {f_rounded_box(x, y, z, 0.1, 1.19, 0.3,
0.4)+f_granite(x+rand(Seed),
> >               y+rand(Seed), z+rand(Seed))*0.09}
> I get the message:
> > Parse Error: Expected 'function identifier', } found instead
> However, when I use:
> > #declare Index = 0;
> > #while (Index<29)
> > #local RX=rand(Seed);
> > #local RY=rand(Seed);
> > #local RZ=rand(Seed);
> >       isosurface {
> >               function {f_rounded_box(x, y, z, 0.1, 1.19, 0.3,
0.4)+f_granite(x+RX,
> >               y+RY, z+RZ)*0.09}
> Everything works as expected.
> What's happening? Surely Pov's only got to look up the next number in
> the random stream which can't be much different from looking up the
> values of the declared variables.
  rand() is not a function supported inside user-defined functions, it's
that simple.
  (While user-defined functions and SDL math expressions might look similar,
they are completely separate. It can get a bit confusing sometimes.)
-- 
                                                          - Warp Post a reply to this message
 |  |