noise -- Noise functions

noise(x [, y[, z[, t]]]) / noise(point [, t])
Returns a noise value (Perlin) in the range from 0 to 1. The arguments can be up to 4 floating point values or a sequence with up to 4 floating point values (e.g. a vec3 or a vec4). The return value is a pseudo random number in the range from 0 to 1. Due to the nature of this noise implementation (gradient noise) the return value at integer lattice points is always 0.5.

As an example, here's a 2D slice (the grid shows the integer lattice):

Note: The actual function call depends on the number of arguments, so calling noise(x,y) is not the same as calling noise(x,y,0). The former case is a true 2D noise whereas the latter is 3D. The same difference exists between 3D and 4D.

snoise(x [, y[, z[, t]]]) / snoise(point [, t])
Returns a signed noise value (Perlin) in the range from -1 to 1. A call to snoise(args) is equivalent to 2*noise(args)-1.
pnoise(point, period) / pnoise(point, t, pperiod, tperiod)
Periodic noise function. Basically this is the same than noise but with a periodic return value: pnoise(point) = pnoise(point+period). The time value can be either part of the point or it can be specified separately. The point and period must always have the same dimension. The return value is in the range from 0 to 1.
spnoise(point, period) / spnoise(point, t, pperiod, tperiod)
Signed periodic noise function. The return value is in the range from -1 to 1. A call to spnoise(args) is equivalent to 2*pnoise(args)-1.
cellnoise(x [, y[, z[, t]]]) / cellnoise(point [, t])
Returns a pseudo random number which is constant between integer lattice points. The return value is in the range from 0 to 1.

As an example, here's a 2D slice (the grid shows the integer lattice):

scellnoise(x [, y[, z[, t]]]) / scellnoise(point [, t])
Signed cell noise. The return value is in the range from -1 to 1. A call to scellnoise(args) is equivalent to 2*cellnoise(args)-1.
fBm(point, octaves [, lacunarity[, gain]])
Fractional Brownian motion. The argument point must be a sequence of either 2 or 3 float values (e.g. a vec3). This function is a sum of noise values with different frequencies and amplitudes and is equivalent to the following code:

sum = 0.0
amp = 1.0
for i in range(octaves):
    sum += amp*snoise(point)
    amp *= gain
    point *= lacunarity

The default values for lacunarity and gain are 2.0 and 0.5. The return value is in the range from 0 to 1.

As an example, here's a 2D slice (the grid shows the integer lattice):

turbulence(point, octaves [, lacunarity[, gain]])
The code of the turbulence function is very similar to fBm. The difference is that it sums up abs(snoise) instead of noise. However, the return value is in the range from 0 to 1 again.

As an example, here's a 2D slice (the grid shows the integer lattice):


All of the above functions have a vector version that take the same input parameters but return a vector as result. The output always has the same dimension than the input. If the time value is specified separately it doesn't count to the dimension. For example a call to vnoise((x,y,z)) returns a vec3, just as a call to vnoise((x,y,z),t). However, a call to vnoise((x,y,z,t)) returns a vec4.
vnoise(x [, y[, z[, t]]]) / vnoise(point [, t])
See noise().
vsnoise(x [, y[, z[, t]]]) / vsnoise(point [, t])
See snoise().
vpnoise(point, period) / vpnoise(point, t, pperiod, tperiod)
See pnoise().
vspnoise(point, period) / vspnoise(point, t, pperiod, tperiod)
See spnoise().
vcellnoise(x [, y[, z[, t]]]) / vcellnoise(point [, t])
See cellnoise().
vscellnoise(x [, y[, z[, t]]]) / vscellnoise(point [, t])
See scellnoise().
vfBm(point, octaves [, lacunarity[, gain]])
See fBm().
vturbulence(point, octaves [, lacunarity[, gain]])
See turbulence().

Copyright © 2002 Matthias Baas (baas@ira.uka.de)