Noise Utilities (mathutils.noise)

The Blender noise module

mathutils.noise.cell(position)

Returns cell noise value at the specified position.

Parameters:position (mathutils.Vector) – The position to evaluate the selected noise function.
Returns:The cell noise value.
Return type:float
mathutils.noise.cell_vector(position)

Returns cell noise vector at the specified position.

Parameters:position (mathutils.Vector) – The position to evaluate the selected noise function.
Returns:The cell noise vector.
Return type:mathutils.Vector
mathutils.noise.fractal(position, H, lacunarity, octaves, noise_basis='PERLIN_ORIGINAL')

Returns the fractal Brownian motion (fBm) noise value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • H (float) – The fractal increment factor.
  • lacunarity (float) – The gap between successive frequencies.
  • octaves (int) – The number of different noise frequencies used.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The fractal Brownian motion noise value.

Return type:

float

mathutils.noise.hetero_terrain(position, H, lacunarity, octaves, offset, noise_basis='PERLIN_ORIGINAL')

Returns the heterogeneous terrain value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • H (float) – The fractal dimension of the roughest areas.
  • lacunarity (float) – The gap between successive frequencies.
  • octaves (int) – The number of different noise frequencies used.
  • offset (float) – The height of the terrain above ‘sea level’.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The heterogeneous terrain value.

Return type:

float

mathutils.noise.hybrid_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis='PERLIN_ORIGINAL')

Returns hybrid multifractal value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • H (float) – The fractal dimension of the roughest areas.
  • lacunarity (float) – The gap between successive frequencies.
  • octaves (int) – The number of different noise frequencies used.
  • offset (float) – The height of the terrain above ‘sea level’.
  • gain (float) – Scaling applied to the values.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The hybrid multifractal value.

Return type:

float

mathutils.noise.multi_fractal(position, H, lacunarity, octaves, noise_basis='PERLIN_ORIGINAL')

Returns multifractal noise value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • H (float) – The fractal increment factor.
  • lacunarity (float) – The gap between successive frequencies.
  • octaves (int) – The number of different noise frequencies used.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The multifractal noise value.

Return type:

float

mathutils.noise.noise(position, noise_basis='PERLIN_ORIGINAL')

Returns noise value from the noise basis at the position specified.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The noise value.

Return type:

float

mathutils.noise.noise_vector(position, noise_basis='PERLIN_ORIGINAL')

Returns the noise vector from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The noise vector.

Return type:

mathutils.Vector

mathutils.noise.random()

Returns a random number in the range [0, 1).

Returns:The random number.
Return type:float
mathutils.noise.random_unit_vector(size=3)

Returns a unit vector with random entries.

Parameters:size (int) – The size of the vector to be produced, in the range [2, 4].
Returns:The random unit vector.
Return type:mathutils.Vector
mathutils.noise.random_vector(size=3)

Returns a vector with random entries in the range (-1, 1).

Parameters:size (int) – The size of the vector to be produced.
Returns:The random vector.
Return type:mathutils.Vector
mathutils.noise.ridged_multi_fractal(position, H, lacunarity, octaves, offset, gain, noise_basis='PERLIN_ORIGINAL')

Returns ridged multifractal value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • H (float) – The fractal dimension of the roughest areas.
  • lacunarity (float) – The gap between successive frequencies.
  • octaves (int) – The number of different noise frequencies used.
  • offset (float) – The height of the terrain above ‘sea level’.
  • gain (float) – Scaling applied to the values.
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The ridged multifractal value.

Return type:

float

mathutils.noise.seed_set(seed)

Sets the random seed used for random_unit_vector, and random.

Parameters:seed (int) – Seed used for the random generator. When seed is zero, the current time will be used instead.
mathutils.noise.turbulence(position, octaves, hard, noise_basis='PERLIN_ORIGINAL', amplitude_scale=0.5, frequency_scale=2.0)

Returns the turbulence value from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • octaves (int) – The number of different noise frequencies used.
  • hard (boolean) – Specifies whether returned turbulence is hard (sharp transitions) or soft (smooth transitions).
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
  • amplitude_scale (float) – The amplitude scaling factor.
  • frequency_scale (float) – The frequency scaling factor
Returns:

The turbulence value.

Return type:

float

mathutils.noise.turbulence_vector(position, octaves, hard, noise_basis='PERLIN_ORIGINAL', amplitude_scale=0.5, frequency_scale=2.0)

Returns the turbulence vector from the noise basis at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • octaves (int) – The number of different noise frequencies used.
  • hard (:boolean) – Specifies whether returned turbulence is hard (sharp transitions) or soft (smooth transitions).
  • noise_basis (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
  • amplitude_scale (float) – The amplitude scaling factor.
  • frequency_scale (float) – The frequency scaling factor
Returns:

The turbulence vector.

Return type:

mathutils.Vector

mathutils.noise.variable_lacunarity(position, distortion, noise_type1='PERLIN_ORIGINAL', noise_type2='PERLIN_ORIGINAL')

Returns variable lacunarity noise value, a distorted variety of noise, from noise type 1 distorted by noise type 2 at the specified position.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • distortion (float) – The amount of distortion.
  • noise_type1 (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
  • noise_type2 (string) – Enumerator in [‘BLENDER’, ‘PERLIN_ORIGINAL’, ‘PERLIN_NEW’, ‘VORONOI_F1’, ‘VORONOI_F2’, ‘VORONOI_F3’, ‘VORONOI_F4’, ‘VORONOI_F2F1’, ‘VORONOI_CRACKLE’, ‘CELLNOISE’].
Returns:

The variable lacunarity noise value.

Return type:

float

mathutils.noise.voronoi(position, distance_metric='DISTANCE', exponent=2.5)

Returns a list of distances to the four closest features and their locations.

Parameters:
  • position (mathutils.Vector) – The position to evaluate the selected noise function.
  • distance_metric (string) – Enumerator in [‘DISTANCE’, ‘DISTANCE_SQUARED’, ‘MANHATTAN’, ‘CHEBYCHEV’, ‘MINKOVSKY’, ‘MINKOVSKY_HALF’, ‘MINKOVSKY_FOUR’].
  • exponent (float) – The exponent for Minkowski distance metric.
Returns:

A list of distances to the four closest features and their locations.

Return type:

list of four floats, list of four mathutils.Vector types