POV-Ray : Newsgroups : povray.programming : Wondering about Noise() : Re: Wondering about Noise() Server Time
28 Jul 2024 18:18:28 EDT (-0400)
  Re: Wondering about Noise()  
From: Alexander Enzmann
Date: 12 Nov 1999 07:24:04
Message: <382C0718.48700623@mitre.org>
"Gerald K. Dobiasovsky" wrote:
> 
> Alexander Enzmann <xan### [at] mitreorg> wrote:
> > Perhaps someone can shed a little light on the POV-Ray noise function.
...
> 
> The basic algorithm doesn't seem to have changed since DKB,
> but since POV 3.0 the random float table exists precomputed in
> "texture.c" rather than being calculated from a CRC table after startup.
> (The range of the numbers in the table is -1.0 < # < 1.0)

Ok - I won't bother looking at the earlier versions then.

> 
> I am surprised your results are shifted towards negative values.
> Looking at the algorithm used
> (at least as I understand it, or, rather, I believe I understand it :) )
> one would expect its range to be bigger than -0.5 to 0.5,
> but still with a symmetrical distribution about 0.0!

After a little more examination, it turns out that while the Noise()
function has problems, the DNoise() function produces reasonable
results.

As before, looking at several million samples of DNoise(), the following
values are what I saw.  [I sampled the three components of DNoise()
separately.]

POV-Ray Min: -1.05242,-1.00514,-1.04398, Max: 0.964014,0.986572,0.988593
Mean: -0.0192643,-0.0158032,-0.0162188
Median: -0.0183217,-0.0144683,-0.0156189
Std Dev: 0.256747,0.254648,0.255912

There is a small negative bias in the results, but nowhere near the ones
for Noise().  In contrast, the equivalent Perlin function gave me the
following statistics:

Noise Min: -1,-0.994576,-1, Max: 1,0.989578,1
Mean: 0.000336202,0.000105581,0.000179304
Median: -0.000122128,-0.000618196,-0.000264098
Std Dev: 0.271045,0.27106,0.271046

These are basically close enough for texturing work.  So, what does it
affect in POV-Ray?  Functions that directly call Noise() are: Bozo,
Granite, Spotted, Bumps, Dents, Wrinkles, The functions that use
Turbulence() (based on Noise()) are: Marble, Agate, and Irid. 
Turbulence warps are based on DTurbulence() (which uses DNoise()).

> 
> Contrary to (AFAIK) Perlin noise the random vectors at the integer
> lattice points in POV are not of unit length,
> but are in the range of -sqrt(3) to sqrt(3), because the vectors are
> built by simply assigning each component a value from the random number
> table.

Quite true.

> ...
> The extreme case (point at the center of a lattice cell, all random vectors
> having maximum possible length _and_ looking exactly to the cell's
> center or away from it _and_ the scalars that get added all having the
> same sign as the dot products) would return +/-2.0 before adding 0.5
> and clamping.

I'm not too sure about that.  Since a trilinear interpolation is
performed, I would think that the result would actually end up at 0 (no
turbulence).

Xander


Post a reply to this message

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