OpenSimplexNoise
Inherits: Resource < Reference < Object
Noise generator based on Open Simplex.
Description
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
|
||
|
||
|
||
|
||
|
Methods
get_image ( int width, int height, Vector2 noise_offset=Vector2( 0, 0 ) ) const |
|
get_noise_1d ( float x ) const |
|
get_noise_2d ( float x, float y ) const |
|
get_noise_2dv ( Vector2 pos ) const |
|
get_noise_3d ( float x, float y, float z ) const |
|
get_noise_3dv ( Vector3 pos ) const |
|
get_noise_4d ( float x, float y, float z, float w ) const |
|
get_seamless_image ( int size ) const |
Property Descriptions
float lacunarity
Default |
|
Setter |
set_lacunarity(value) |
Getter |
get_lacunarity() |
Controls period change across octaves. 2 is usually a good value to address all detail levels.
int octaves
Default |
|
Setter |
set_octaves(value) |
Getter |
get_octaves() |
The number of noise layers that are sampled to get the fractal noise. Higher values result in more detailed noise but take exponentially more time to generate.
Note: The maximum allowed value is 9.
float period
Default |
|
Setter |
set_period(value) |
Getter |
get_period() |
The distance above which we start to see similarities. Higher values create longer "hills". Lower values result in a higher-frequency noise.
float persistence
Default |
|
Setter |
set_persistence(value) |
Getter |
get_persistence() |
Determines the contribution of each octave. A 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. Higher values increase grain, lower values increase smoothness.
int seed
Default |
|
Setter |
set_seed(value) |
Getter |
get_seed() |
Seed used to generate random values, different seeds will generate different noise maps.
Method Descriptions
Generate a noise image in Image.FORMAT_L8 format with the requested width and height, based on the current noise parameters. If noise_offset is specified, then the offset value is used as the coordinates of the top-left corner of the generated noise.
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.
Returns the 2D noise value [-1,1] at the given position.
Returns the 2D noise value [-1,1] at the given position.
Returns the 3D noise value [-1,1] at the given position.
Returns the 3D noise value [-1,1] at the given position.
Returns the 4D noise value [-1,1] at the given position.
Generate a tileable noise image in Image.FORMAT_L8 format, based on the current noise parameters. Generated seamless images are always square (size × size).
Note: Seamless noise has a lower contrast compared to non-seamless noise. This is due to the way noise uses higher dimensions for generating seamless noise.