FastNoise2

Inherits: Resource

Wrapper for the FastNoise2 library.

Description:

Generates coherent noise with support for SIMD processing, which can speed up generation significantly compared to scalar implementations like FastNoiseLite.

It uses a node-based structure internally for configuration, which is however not editable from within Godot at the moment. Instead, simplified properties are exposed. It possible to edit noise graphs with an external Noise Tool, which can export an encoded node tree as a base64 string.

The current integration uses FastNoise2 version 0.10.0-alpha. If you use encoded node trees made with the Noise Tool, it must match that version.

Properties:

Type Name Default
int cellular_distance_function 0
float cellular_jitter 1.0
int cellular_return_type 0
String encoded_node_tree ""
float fractal_gain 0.5
float fractal_lacunarity 2.0
int fractal_octaves 3
float fractal_ping_pong_strength 2.0
int fractal_type 0
int noise_type 0
float period 64.0
bool remap_enabled false
float remap_input_max 1.0
float remap_input_min -1.0
float remap_output_max 1.0
float remap_output_min -1.0
int seed 1337
bool terrace_enabled false
float terrace_multiplier 1.0
float terrace_smoothness 0.0

Methods:

Return Signature
void generate_image ( Image image, bool tileable ) const
float get_noise_2d_single ( Vector2 pos ) const
float get_noise_3d_single ( Vector3 pos ) const
String get_simd_level_name ( int level )
void update_generator ( )

Enumerations:

enum NoiseType:

  • TYPE_OPEN_SIMPLEX_2 = 0
  • TYPE_SIMPLEX = 1
  • TYPE_PERLIN = 2
  • TYPE_VALUE = 3
  • TYPE_CELLULAR = 4
  • TYPE_ENCODED_NODE_TREE = 5

enum FractalType:

  • FRACTAL_NONE = 0
  • FRACTAL_FBM = 1
  • FRACTAL_RIDGED = 2
  • FRACTAL_PING_PONG = 3

enum CellularDistanceFunction:

  • CELLULAR_DISTANCE_EUCLIDEAN = 0
  • CELLULAR_DISTANCE_EUCLIDEAN_SQ = 1
  • CELLULAR_DISTANCE_MANHATTAN = 2
  • CELLULAR_DISTANCE_HYBRID = 3
  • CELLULAR_DISTANCE_MAX_AXIS = 4

enum CellularReturnType:

  • CELLULAR_RETURN_INDEX_0 = 0
  • CELLULAR_RETURN_INDEX_0_ADD_1 = 1
  • CELLULAR_RETURN_INDEX_0_SUB_1 = 2
  • CELLULAR_RETURN_INDEX_0_MUL_1 = 3
  • CELLULAR_RETURN_INDEX_0_DIV_1 = 4

enum SIMDLevel:

  • SIMD_NULL = 0 --- Undefined level.
  • SIMD_SCALAR = 1 --- Single numbers. Slowest level.
  • SIMD_SSE = 2 --- x86 CPU processing 4 floats in one instruction.
  • SIMD_SSE2 = 4 --- x86 CPU Processing 4 floats in one instruction, with more instructions supported than SSE.
  • SIMD_SSE3 = 8 --- x86 CPU Processing 4 floats in one instruction, with more instructions supported than SSE3.
  • SIMD_SSSE3 = 16 --- x86 CPU Processing 4 floats in one instruction, with more instructions supported than SSE4.
  • SIMD_SSE41 = 32 --- x86 CPU Processing 4 floats in one instruction, with more instructions supported than SSE41.
  • SIMD_SSE42 = 64 --- x86 CPU Processing 4 floats in one instruction, with more instructions supported than SSE42.
  • SIMD_AVX = 128 --- x86 CPU Processing 8 floats in one instruction.
  • SIMD_AVX2 = 256 --- x86 CPU Processing 8 floats in one instruction, with more instructions supported than AVX.
  • SIMD_AVX512 = 512 --- x86 CPU Processing 16 floats in one instruction.
  • SIMD_NEON = 65536 --- ARM CPU processing 4 floats in one instruction.

Property Descriptions

int cellular_distance_function = 0

(This property has no documentation)

float cellular_jitter = 1.0

(This property has no documentation)

int cellular_return_type = 0

(This property has no documentation)

String encoded_node_tree = ""

(This property has no documentation)

float fractal_gain = 0.5

(This property has no documentation)

float fractal_lacunarity = 2.0

(This property has no documentation)

int fractal_octaves = 3

(This property has no documentation)

float fractal_ping_pong_strength = 2.0

(This property has no documentation)

int fractal_type = 0

(This property has no documentation)

int noise_type = 0

(This property has no documentation)

float period = 64.0

(This property has no documentation)

bool remap_enabled = false

(This property has no documentation)

float remap_input_max = 1.0

(This property has no documentation)

float remap_input_min = -1.0

(This property has no documentation)

float remap_output_max = 1.0

(This property has no documentation)

float remap_output_min = -1.0

(This property has no documentation)

int seed = 1337

(This property has no documentation)

bool terrace_enabled = false

(This property has no documentation)

float terrace_multiplier = 1.0

(This property has no documentation)

float terrace_smoothness = 0.0

(This property has no documentation)

Method Descriptions

void generate_image( Image image, bool tileable )

Fills a greyscale image with noise values.

float get_noise_2d_single( Vector2 pos )

Generates a single value of 2D noise.

Note that generating values one by one will not benefit from SIMD performance as much as generating multiple values at once.

float get_noise_3d_single( Vector3 pos )

Generates a single value of 3D noise.

Note that generating values one by one will not benefit from SIMD performance as much as generating multiple values at once.

String get_simd_level_name( int level )

Gets which SIMD level was detected by the library. This gives an indication of performance on the current CPU, as different models can have different SIMD instructions available.

void update_generator( )

This method must be called after you change properties, so they can take effect.

Generated on Apr 06, 2024