Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

FastNoiseLite

繼承: Noise < Resource < RefCounted < Object

使用 FastNoiseLite 庫生成雜訊。

說明

該類使用 FastNoiseLite 庫生成雜訊,該庫是多種雜訊演算法的集合,包括 Cellular、Perlin、Value 等。

大多數生成的雜訊值都在 [-1,1] 範圍內,但並非總是如此。一些蜂窩噪聲演算法返回高於 1 的結果。

屬性

CellularDistanceFunction

cellular_distance_function

0

float

cellular_jitter

1.0

CellularReturnType

cellular_return_type

1

float

domain_warp_amplitude

30.0

bool

domain_warp_enabled

false

float

domain_warp_fractal_gain

0.5

float

domain_warp_fractal_lacunarity

6.0

int

domain_warp_fractal_octaves

5

DomainWarpFractalType

domain_warp_fractal_type

1

float

domain_warp_frequency

0.05

DomainWarpType

domain_warp_type

0

float

fractal_gain

0.5

float

fractal_lacunarity

2.0

int

fractal_octaves

5

float

fractal_ping_pong_strength

2.0

FractalType

fractal_type

1

float

fractal_weighted_strength

0.0

float

frequency

0.01

NoiseType

noise_type

1

Vector3

offset

Vector3(0, 0, 0)

int

seed

0


列舉

enum NoiseType: 🔗

NoiseType TYPE_VALUE = 5

點陣被分配隨機值,然後根據相鄰值進行插值。

NoiseType TYPE_VALUE_CUBIC = 4

Similar to value noise (TYPE_VALUE), but slower. Has more variance in peaks and valleys.

Cubic noise can be used to avoid certain artifacts when using value noise to create a bumpmap. In general, you should always use this mode if the value noise is being used for a heightmap or bumpmap.

NoiseType TYPE_PERLIN = 3

隨機漸變的一種格子。對它們的點積進行插值,以獲得格子之間的值。

NoiseType TYPE_CELLULAR = 2

蜂窩包括 Worley 雜訊圖和 Voronoi 圖,它們建立了相同值的不同區域。

NoiseType TYPE_SIMPLEX = 0

As opposed to TYPE_PERLIN, gradients exist in a simplex lattice rather than a grid lattice, avoiding directional artifacts. Internally uses FastNoiseLite's OpenSimplex2 noise type.

NoiseType TYPE_SIMPLEX_SMOOTH = 1

Modified, higher quality version of TYPE_SIMPLEX, but slower. Internally uses FastNoiseLite's OpenSimplex2S noise type.


enum FractalType: 🔗

FractalType FRACTAL_NONE = 0

無分形雜訊。

FractalType FRACTAL_FBM = 1

使用分形布朗運動將八度音階組合成分形的方法。

FractalType FRACTAL_RIDGED = 2

將八度音階組合成分形的方法,從而產生一種“脊狀”外觀。

FractalType FRACTAL_PING_PONG = 3

將八度音階組合成具有乒乓效果的分形的方法。


enum CellularDistanceFunction: 🔗

CellularDistanceFunction DISTANCE_EUCLIDEAN = 0

到最近點的歐幾裡得距離。

CellularDistanceFunction DISTANCE_EUCLIDEAN_SQUARED = 1

到最近點的歐幾裡得距離的平方。

CellularDistanceFunction DISTANCE_MANHATTAN = 2

到最近點的曼哈頓距離(計程車度量法)。

CellularDistanceFunction DISTANCE_HYBRID = 3

Blend of DISTANCE_EUCLIDEAN and DISTANCE_MANHATTAN to give curved cell boundaries.


enum CellularReturnType: 🔗

CellularReturnType RETURN_CELL_VALUE = 0

蜂窩儲存格距離函式,將為儲存格內的所有點返回相同的值。

CellularReturnType RETURN_DISTANCE = 1

蜂窩儲存格距離函式,將返回一個由到最近點的距離確定的值。

CellularReturnType RETURN_DISTANCE2 = 2

蜂窩儲存格距離函式,將返回到第二最近點的距離。

CellularReturnType RETURN_DISTANCE2_ADD = 3

將最近點的距離與次近點的距離相加。

CellularReturnType RETURN_DISTANCE2_SUB = 4

將最近點的距離與次近點的距離相減。

CellularReturnType RETURN_DISTANCE2_MUL = 5

將最近點的距離與次近點的距離相乘。

CellularReturnType RETURN_DISTANCE2_DIV = 6

將最近點的距離與次近點的距離相除。


enum DomainWarpType: 🔗

DomainWarpType DOMAIN_WARP_SIMPLEX = 0

使用單純形雜訊演算法,對域進行扭曲。

DomainWarpType DOMAIN_WARP_SIMPLEX_REDUCED = 1

使用簡化版的單純形雜訊演算法,對域進行扭曲。

DomainWarpType DOMAIN_WARP_BASIC_GRID = 2

使用簡單的雜訊柵格(不像其他方法那樣平滑,但性能更高),對域進行扭曲。


enum DomainWarpFractalType: 🔗

DomainWarpFractalType DOMAIN_WARP_FRACTAL_NONE = 0

沒有用於扭曲空間的分形雜訊。

DomainWarpFractalType DOMAIN_WARP_FRACTAL_PROGRESSIVE = 1

逐漸扭曲空間,一個八度一個八度,導致更“液化”的失真。

DomainWarpFractalType DOMAIN_WARP_FRACTAL_INDEPENDENT = 2

為每個八度音階獨立地扭曲空間,從而導致更混亂的失真。


屬性說明

CellularDistanceFunction cellular_distance_function = 0 🔗

Determines how the distance to the nearest/second-nearest point is computed.


float cellular_jitter = 1.0 🔗

  • void set_cellular_jitter(value: float)

  • float get_cellular_jitter()

一個點可以離開其柵格位置的最大距離。對於偶數柵格,設定為 0


CellularReturnType cellular_return_type = 1 🔗

Return type from cellular noise calculations.


float domain_warp_amplitude = 30.0 🔗

  • void set_domain_warp_amplitude(value: float)

  • float get_domain_warp_amplitude()

設定距原點的最大扭曲距離。


bool domain_warp_enabled = false 🔗

  • void set_domain_warp_enabled(value: bool)

  • bool is_domain_warp_enabled()

如果啟用,則另一個 FastNoiseLite 實例將被用於扭曲空間,從而導致雜訊失真。


float domain_warp_fractal_gain = 0.5 🔗

  • void set_domain_warp_fractal_gain(value: float)

  • float get_domain_warp_fractal_gain()

確定用於扭曲空間的雜訊的每個後續層的強度。

較低的值更強調較低頻率的基礎層,而較高的值則更強調較高頻率的層。


float domain_warp_fractal_lacunarity = 6.0 🔗

  • void set_domain_warp_fractal_lacunarity(value: float)

  • float get_domain_warp_fractal_lacunarity()

The change in frequency between octaves, also known as "lacunarity", of the fractal noise which warps the space. Increasing this value results in higher octaves, producing noise with finer details and a rougher appearance.


int domain_warp_fractal_octaves = 5 🔗

  • void set_domain_warp_fractal_octaves(value: int)

  • int get_domain_warp_fractal_octaves()

為獲得扭曲空間的分形雜訊的最終值而取樣的雜訊層數。


DomainWarpFractalType domain_warp_fractal_type = 1 🔗

The method for combining octaves into a fractal which is used to warp the space.


float domain_warp_frequency = 0.05 🔗

  • void set_domain_warp_frequency(value: float)

  • float get_domain_warp_frequency()

扭曲空間的噪音頻率。低頻產生平滑的雜訊,而高頻產生更粗糙、顆粒狀更明顯的噪聲。


DomainWarpType domain_warp_type = 0 🔗

The warp algorithm.


float fractal_gain = 0.5 🔗

  • void set_fractal_gain(value: float)

  • float get_fractal_gain()

確定分形雜訊中雜訊的每個後續層的強度。

較低的值更強調較低頻率的基礎層,而較高的值則更強調較高頻率的層。


float fractal_lacunarity = 2.0 🔗

  • void set_fractal_lacunarity(value: float)

  • float get_fractal_lacunarity()

後續八度音階之間的倍頻器。增加該值,會產生更高的八度音階,從而產生細節更精細、外觀更粗糙的雜訊。


int fractal_octaves = 5 🔗

  • void set_fractal_octaves(value: int)

  • int get_fractal_octaves()

為獲得分形雜訊型別的最終值而取樣的雜訊層數。


float fractal_ping_pong_strength = 2.0 🔗

  • void set_fractal_ping_pong_strength(value: float)

  • float get_fractal_ping_pong_strength()

設定分形乒乓型別的強度。


FractalType fractal_type = 1 🔗

The method for combining octaves into a fractal.


float fractal_weighted_strength = 0.0 🔗

  • void set_fractal_weighted_strength(value: float)

  • float get_fractal_weighted_strength()

較高的權重意味著如果較低的八度具有較大的影響,則較高的八度具有較小的影響。


float frequency = 0.01 🔗

  • void set_frequency(value: float)

  • float get_frequency()

所有雜訊型別的頻率。低頻產生平滑的雜訊,而高頻產生更粗糙、顆粒狀更明顯的噪聲。


NoiseType noise_type = 1 🔗

The noise algorithm used.


Vector3 offset = Vector3(0, 0, 0) 🔗

使用給定的 Vector3 對雜訊輸入座標進行平移。


int seed = 0 🔗

  • void set_seed(value: int)

  • int get_seed()

所有雜訊型別的亂數種子。