Noise generator based on Open Simplex.
    public class OpenSimplexNoise : Resource

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:

[codeblock]

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))

[/codeblock]

Inheritance Chain

Constructors

    public OpenSimplexNoise()

Properties

    public float Lacunarity { get; set; }

Difference in period between Octaves.

    public int Octaves { get; set; }

Number of OpenSimplex noise layers that are sampled to get the fractal noise.

    public float Period { get; set; }

Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).

    public float Persistence { get; set; }

Contribution 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.

    public int Seed { get; set; }

Seed used to generate random values, different seeds will generate different noise maps.

Methods

    public Image GetImage(int width, int height)

Generate a noise image with the requested width and height, based on the current noise parameters.

    [Obsolete("GetLacunarity is deprecated. Use the Lacunarity property instead.")]
    public float GetLacunarity()

Getter for Lacunarity

    public float GetNoise1d(float x)

Returns the 1D noise value [-1,1] at the given x-coordinate.

Note: This method actually returns the 2D noise value [-1,1] with fixed y-coordinate value 0.0.

    public float GetNoise2d(float x, float y)

Returns the 2D noise value [-1,1] at the given position.

    public float GetNoise2dv(Vector2 pos)

Returns the 2D noise value [-1,1] at the given position.

    public float GetNoise3d(float x, float y, float z)

Returns the 3D noise value [-1,1] at the given position.

    public float GetNoise3dv(Vector3 pos)

Returns the 3D noise value [-1,1] at the given position.

    public float GetNoise4d(float x, float y, float z, float w)

Returns the 4D noise value [-1,1] at the given position.

    [Obsolete("GetOctaves is deprecated. Use the Octaves property instead.")]
    public int GetOctaves()

Getter for Octaves

    [Obsolete("GetPeriod is deprecated. Use the Period property instead.")]
    public float GetPeriod()

Getter for Period

    [Obsolete("GetPersistence is deprecated. Use the Persistence property instead.")]
    public float GetPersistence()

Getter for Persistence

    public Image GetSeamlessImage(int size)

Generate a tileable noise image, based on the current noise parameters. Generated seamless images are always square (size × size).

    [Obsolete("GetSeed is deprecated. Use the Seed property instead.")]
    public int GetSeed()

Getter for Seed

    [Obsolete("SetLacunarity is deprecated. Use the Lacunarity property instead.")]
    public void SetLacunarity(float lacunarity)

Setter for Lacunarity

    [Obsolete("SetOctaves is deprecated. Use the Octaves property instead.")]
    public void SetOctaves(int octaveCount)

Setter for Octaves

    [Obsolete("SetPeriod is deprecated. Use the Period property instead.")]
    public void SetPeriod(float period)

Setter for Period

    [Obsolete("SetPersistence is deprecated. Use the Persistence property instead.")]
    public void SetPersistence(float persistence)

Setter for Persistence

    [Obsolete("SetSeed is deprecated. Use the Seed property instead.")]
    public void SetSeed(int seed)

Setter for Seed

Tags: