I looked online and found quite a useful equation for generating
gaussian random nubmers. This macro generates a random number that is
roughly between -3 and 3. The numbers will be normally distributed
(mean = 0 standard deviation 1).
This is very useful for something like randomly rotating bricks or
tiles. Using the pov-ray random function, they would all be rotated
randomly from 0 degrees to x degrees, but with this macro, about 2/3 are
between 0 and x degrees while there are a few outliers. It gives it a
more natural look.
- Rico
Here's the site in case someone wants to take a look at the second
equation (I couldn't get it to work correctly):
http://www.taygeta.com/random/gaussian.html
And here's the macro:
#declare e = 2.718281828459;
#macro gauss(RSR)
sqrt(-2*log(rand(RSR))/log(e))*cos(2*pi*rand(RSR))
#end
Post a reply to this message
|