POV-Ray : Newsgroups : povray.general : problem: repeating rand patterns using seed in animation : Re: problem: repeating rand patterns using seed in animation Server Time
30 Jul 2024 18:19:47 EDT (-0400)
  Re: problem: repeating rand patterns using seed in animation  
From: John VanSickle
Date: 24 Jan 2009 16:58:15
Message: <497b8ef7$1@news.povray.org>
Kenneth 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.
> 
> The problem arose by using seed(clock) or seed(frame_number) in my SDL scene to
> generate different random seed streams for each frame (a standard method?) then
> pulling only one rand() value from that per frame--which made the patterns very
> apparent. I *thought* that by simply throwing some multiplier value 'M'
> at seed(M*clock) or seed(M*frame_number)--just one time in my POV scene, to use
> for the entire animation--would give me 'obvious' random numbers from frame to
> frame. Unfortunately, not so. There are, to my great surprise, clear
> *almost*-repeating rand() patterns, no matter what seed values I use. And it
> shows up quite quickly in animation--usually over 5 to 10 frames. I've included
> some small test code. A few newsgroup posts mention that the current
> random-number-generator in POV may need to be improved; my animation indicates
> that as well.

I think I got this kinda solved by using this:

#local rsA=seed(frame_number);
#local rsB=seed(floor(rand(rsA)*270000));
#local rsC=seed(floor(rand(rsB)*270000));

and use rsC as your seed.

Hope this helps,
John


Post a reply to this message

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