|
![](/i/fill.gif) |
Warp <war### [at] tag povray org> wrote:
> Kenneth <kdw### [at] earthlink net> wrote:
> > I've run into an interesting and totally unexpected situation in v3.6.1 while
> > animating, trying to produce some random values from frame to frame. I'm seeing
> > repeating patterns in the values; nothing that I try eliminates them.
>
> POV-Ray uses a linear congruential generator as RNG, and those tend to
> produce patterns in certain situations.
>
> What you can do to get a more random sequence is this:
>
> 1) On the first frame seed the RNG with whatever value (eg. 0).
> 2) Then pull a value with rand(), multiply it by a large value and
> #write it to a file. Then use the value in your scene in any way
> you want.
> 3) In subsequent frames #read that value from the file and give it to seed()
> 4) Repeat the steps 2 and 3.
>
> --
> - Warp
Another interesting idea; thanks. I see that it would produce what's needed:
Each subsequent frame's seed is using the rand() value from the previous frame
for ITS value; so even though there are patterns, each new frame sees what
amounts to a different pattern (if I'm thinking correctly.) Nice.
Post a reply to this message
|
![](/i/fill.gif) |