POV-Ray : Newsgroups : povray.advanced-users : Randomizing pattern functions : Re: Randomizing pattern functions Server Time
28 Jul 2024 20:27:57 EDT (-0400)
  Re: Randomizing pattern functions  
From: David Wallace
Date: 11 Jan 2004 22:01:34
Message: <40020e0e@news.povray.org>
If you are going to generate a large number of rocks you might want to pass
an actual seed into the macro rather than just an integer.  That way you get
new rocks each time you call the macro.

"Mike Williams" <nos### [at] econymdemoncouk> wrote in message
news:iDTbvBAKjk+$EwQ### [at] econymdemoncouk...
> Wasn't it Dan P who wrote:
> >I'm attempting to generate a macro that spits out an isosurface that
> >generates a boulder depending upon a seed. Then, I will take and write a
> >macro that spits them all out on a grid so that I can pick and choose
from a
> >contact sheet.
> >
> >I figured that translating a pattern would be like translating a pigment
and
> >that randomly translating it's position would give me different forms.
> >However, I can't pass another parameter to a pattern function, so I'm not
> >sure how to get the translation inside of the pattern{} block.
> >
> >Has anyone tried this kind of thing? Thanks!
>
> I'd tend to do it by sticking the translation inside the isosurface {}
> by variable substitution
> (see http://www.econym.demon.co.uk/isotut/substitute.htm)
> like this:
>
---- edited code ----
#declare rs = seed(4394); // Use your own number

 #macro rock1 (sd, sz)

 #local R1=rand(sd)*sz;
 #local R2=rand(sd)*sz;
 #local R3=rand(sd)*sz;

  isosurface
  {
   function { (f_sphere (x, y, z, 1)
             + f_rock1_1(x+R1, y+R2, z+R3)
             + f_rock1_2(x+R1, y+R2, z+R3) )
              / 3 }
  ...
---- edited code ----
>
>
> Note that you can't use rand() inside the isosurface function definition
> itself.
>
> -- 

-- 
David Wallace
TenArbor Consulting
"Just in Time Cash"
http://www.tenarbor.com


Post a reply to this message

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