Up to date

This page is up to date for Godot 4.0. If you still find outdated information, please open an issue.

Noise

Inherits: Resource < RefCounted < Object

Inherited By: FastNoiseLite

Abstract base class for noise generators.

Description

This class defines the interface for noise generation libraries to inherit from.

A default get_seamless_noise() implementation is provided for libraries that do not provide seamless noise. This function requests a larger image from get_image(), reverses the quadrants of the image, then uses the strips of extra width to blend over the seams.

Inheriting noise classes can optionally override this function to provide a more optimal algorithm.

Methods

Image

get_image ( int width, int height, bool invert=false, bool in_3d_space=false, bool normalize=true ) const

float

get_noise_1d ( float x ) const

float

get_noise_2d ( float x, float y ) const

float

get_noise_2dv ( Vector2 v ) const

float

get_noise_3d ( float x, float y, float z ) const

float

get_noise_3dv ( Vector3 v ) const

Image

get_seamless_image ( int width, int height, bool invert=false, bool in_3d_space=false, float skirt=0.1, bool normalize=true ) const


Method Descriptions

Image get_image ( int width, int height, bool invert=false, bool in_3d_space=false, bool normalize=true ) const

Returns a 2D Image noise image.

Note: With normalize set to false the default implementation expects the noise generator to return values in the range -1.0 to 1.0.


float get_noise_1d ( float x ) const

Returns the 1D noise value at the given (x) coordinate.


float get_noise_2d ( float x, float y ) const

Returns the 2D noise value at the given position.


float get_noise_2dv ( Vector2 v ) const

Returns the 2D noise value at the given position.


float get_noise_3d ( float x, float y, float z ) const

Returns the 3D noise value at the given position.


float get_noise_3dv ( Vector3 v ) const

Returns the 3D noise value at the given position.


Image get_seamless_image ( int width, int height, bool invert=false, bool in_3d_space=false, float skirt=0.1, bool normalize=true ) const

Returns a seamless 2D Image noise image.

Note: With normalize set to false the default implementation expects the noise generator to return values in the range -1.0 to 1.0.