Not logged in

The noise module adds functions for dealing with solid noise. Solid noise generators are simply infinite surfaces, and thus can use all the normal surface machinery.

Perlin noise generators

Surface.noise(sx,sy[,r]) (Surface constructor)

Constructs a new surface based on classical Perlin noise, scaled by (sx,sy). (A random generator can optionally be passed as the third argument.)

Surface.simplexNoise(sx,sy[,n]) (Surface constructor)

Constructs a new surface based on simplex Perlin noise, scaled by (sx,sy). (A random generator can optionally be passed as the third argument.)

Cellular noise generators

All of the cellular noise generators are based around distributing feature points randomly throughout the texture space. The values of the surface are then a function of the displacements from the sample point to all the feature points within a 2x2 square centered on the sample point. For example, the default voronoi {Worley 1996} generator computes the minimum distance to any feature point as its value, while sparse convolution {Frisvad 2007} assigns a cubic (pseudo-Gaussian) kernel to each feature point with random magnitude, and then computes the sum of all such kernels.


Constructs a cellular surface, according to the scale factors sx,sy and the optional generator object gen and random generator r. The default generator object produces Worley F1 noise (i.e., distance to the nearest feature point).
The generator object, if specified, can have any or all of the following fields:


Constructs a new surface using sparse convolution noise {Frisvad 2007}.


Constructs a new Gabor noise {Lagae 2009} surface, optionally using the generator function gen(p,r) to control the spectrum of the generated noise. The generator function is passed a point p and a random generator r and should set two fields on the point:
Note that Gabor noise requires a higher density of points than Worley or sparse convolution noise, and is thus somewhat more expensive to evaluate.

Utility routines

SeedRand(seed) (global constructor)

Returns a new random number generator with the specified seed. This is needed since the normal Math.random() random number generator does not allow us to specify the seed, which is necessary for many noise generation functions. This generator uses the "invertible mapping" technique described in {Klimov 2003}. Note that very large seeds can cause... problems with the generated sequence.

sr.random() (SeedRand method)

Returns the next (pseudo-)random value in the range 0.0 to 1.0.

sr.seed(seed) (SeedRand method)

Sets the seed of the generator to the specified value.