 Built-in functions – Procedural noise functions

## Basic noise

The basic noise function is Perlin noise, which is a pseudo-random noise function.

This is an example of Perlin noise used as a displacement value: noise(real x) real

Returns single-valued (scalar) Perlin noise evaluated at x. Values returned lie in the range from -1 to 1.

noise(vec2 x) real

Returns single-valued Perlin noise evaluated at x.

noise(vec3 x) real

Returns single-valued Perlin noise evaluated at x.

noise3Valued(vec2 pos) vec3

Returns 3-valued noise (each component is a decorrelated noise value) evaluated at 2d-coordinates.

noise3Valued(vec3 pos) vec3

Returns 3-valued noise (each component is a decorrelated noise value) evaluated at 3d-coordinates. An example of 3-valued noise.

noise2D4Valued(real x, real y)

Returns 4-valued noise (each component is a decorrelated noise value) evaluated at 2d-coordinates.

noise4Valued(real x, real y, real z)

Returns 4-valued noise (each component is a decorrelated noise value) evaluated at 3d-coordinates.

## Basic Fractional Brownian Motion noise

This type of noise is made by adding together a number of different frequences of Perlin noise together. FBM, 1 Octave of noise. FBM, 2 Octaves of noise. FBM, 3 Octaves of noise. FBM, 10 Octaves of noise.

fbm(real x, int oc) real

Returns oc octaves of 1-D Fractional Brownian Motion noise evaluated at x.

fbm(vec2 x, int oc) real

Returns oc octaves of 2-D Fractional Brownian Motion noise evaluated at x.

fbm(vec3 x, int oc) real

Returns oc octaves of 3-D Fractional Brownian Motion noise evaluated at x.

## Grid noise

gridNoise(real x) real
gridNoise(vec2 x) real
gridNoise(vec3 x) real

Takes the floor of the coordinates passed in, and then returns a quasi-random value between 0 and 1 for those integer coordinates. Grid noise.

## Voronoi noise

voronoi(vec2 p, real irregularity) vec2

Returns the coordinates of the nearest Voronoi site.
The irregularity argument controls the 'randomness' of the site positions. It should lie in the range [0, 1].
Irregularity of zero corresponds to a regular grid of site positions.
Irregularity of one corresponds to the maximum 'randomness' of cell positions within the grid, so that the grid is not visible. A shader based on Voronoi noise. The white value of the shader is based on the distance in UV space from the shaded point to the nearest Voronoi site. Irregularity = 0.2. A shader based on Voronoi noise. The white value of the shader is based on the distance in UV space from the shaded point to the nearest Voronoi site. Irregularity = 0.8.

voronoi3d(vec3 p, real irregularity) vec3

Similar to above, but takes a 3d vector and returns the nearest Voronoi site in 3d.