|
|
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'll have to go digging around and see if I can find the way POV-Ray
used to compute the solid noise function (using a CRC table, giving a
machine dependent result) and see if it had similar characteristics. In
any case, this really looks abnormal.
Xander
Post a reply to this message
|
|