Struct OpenSimplexNoise

Noise generator based on Open Simplex.

struct OpenSimplexNoise ;

This resource allows you to configure and sample a fractal noise space. Here is a brief usage example that configures an OpenSimplexNoise and gets samples at various positions and dimensions:

var noise = OpenSimplexNoise.new()

# Configure noise.seed = randi() noise.octaves = 4 noise.period = 20.0 noise.persistence = 0.8

# Sample print("Values:") print(noise.get_noise_2d(1.0, 1.0)) print(noise.get_noise_3d(0.5, 3.0, 15.0)) print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))

Properties

NameTypeDescription
lacunarity[get, set] doubleDifference in period between octaves.
octaves[get, set] longNumber of OpenSimplex noise layers that are sampled to get the fractal noise.
period[get, set] doublePeriod of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
persistence[get, set] doubleContribution factor of the different octaves. A persistence value of 1 means all the octaves have the same contribution, a value of 0.5 means each octave contributes half as much as the previous one.
seed[get, set] longSeed used to generate random values, different seeds will generate different noise maps.

Methods

NameDescription
getImage Generate a noise image with the requested width and height, based on the current noise parameters.
getLacunarity
getNoise1d Returns the 1D noise value class="pln">D -1,1 at the given x-coordinate. Note: This method actually returns the 2D noise value class="pln">D -1,1 with fixed y-coordinate value 0.0.
getNoise2d Returns the 2D noise value class="pln">D -1,1 at the given position.
getNoise2dv Returns the 2D noise value class="pln">D -1,1 at the given position.
getNoise3d Returns the 3D noise value class="pln">D -1,1 at the given position.
getNoise3dv Returns the 3D noise value class="pln">D -1,1 at the given position.
getNoise4d Returns the 4D noise value class="pln">D -1,1 at the given position.
getOctaves
getPeriod
getPersistence
getSeamlessImage Generate a tileable noise image, based on the current noise parameters. Generated seamless images are always square (size × size).
getSeed
setLacunarity
setOctaves
setPeriod
setPersistence
setSeed