POV-Ray : Newsgroups : povray.programming : Wondering about Noise() : Re: Wondering about Noise() Server Time
28 Jul 2024 18:26:28 EDT (-0400)
  Re: Wondering about Noise()  
From: Mark Wagner
Date: 10 Nov 1999 00:36:44
Message: <3829046c@news.povray.org>
Alexander Enzmann wrote in message <382898C4.3749B2AA@mitre.org>...
>Perhaps someone can shed a little light on the POV-Ray noise function.
>Looking at the code, towards the bottom of the function Noise(...),
>there is:
>
>  sum = sum + 0.5; /* range at this point -0.5 - 0.5... */
>
>  if (sum < 0.0)
>    sum = 0.0;
>  if (sum > 1.0)
>    sum = 1.0;
>
>However, in attempts to get a distribution of values that come close to
>the POV-Ray noise function out of a standard Perlin noise function, I
>found that there is a problem.
>
>I took several million samples of the noise function in a box with sides
>of length 1000. These are the basic statistics for POV-Ray's Noise(),
>before adding the 0.5 and clamping to the range [0,1]:
>
>Min, max: -1.05242, 0.988997
>Mean: -0.0191481, Median: -0.535493, Std Dev: 0.256828
>
>Clearly, the range of values for sum is not -0.5 to 0.5 as suggested in
>the code.  In fact, since the median value is less than -0.5, the actual
>Noise() returns 0.0 more than half of the time (after adding 0.5 and
>clamping).  Doesn't make sense.
>
>Compare the above to a traditional Perlin solid noise function, which
>for the same set of sample points yields:
>
>Min, max: -0.6746, 0.672579
>Mean: -0.000140859, Median: 0.0487365, Std Dev: 0.180682
>
>As would be expected, the values are centered around 0.  Another
>interesting point is that the standard deviation for the POV-Ray noise
>function is not even close to the Perlin noise.


I found this out myself a few days ago while trying to write a Perlin noise
pattern.  My solution was to simply add a line that divides the sum by 2
before clamping.

Mark


Post a reply to this message

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