POV-Ray : Newsgroups : povray.newusers : Rand and animation : Rand and animation Server Time
29 Jul 2024 18:21:09 EDT (-0400)
  Rand and animation  
From: Bryan Heit
Date: 12 May 2005 19:30:40
Message: <4283e720$1@news.povray.org>
I am having a problem getting rand to work properly with an animation. 
Basically, I'm trying to make the intensity of a light source to flicker 
randomly.  In all cases I have a variable which is used in an if 
statement to make either a "low" or "high" intensity.  In all cases I 
assign a value to a variable "flicker", and use this variable as the 
input for rand.  I've tried the following:

1) #declare flicker=seed(clock); . . .
    #if (rand(flicker)>0.5)
       make bright light
    #else
       make dim light
    #end

When I do this I get all but the last frame dim.  If I seed(clock*100) I 
get the opposite (all frames bright but the last one).

2) #declare flicker=seed(x);, the rest the same as above
In this case I get all dark or all light depending on the value I put in 
as x.

I've tried moving the #declare to the .ini file, but this creates an error.

What I think is happening is that the seed for the rand function gets 
reset each frame, so I essentially end re-starting the rand function 
each time.  Is there a work-around?

thanx

Bryan


Post a reply to this message

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