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.

NoiseTexture3D

繼承: Texture3D < Texture < Resource < RefCounted < Object

Noise 物件生成的雜訊所填充的紋理。

說明

使用 FastNoiseLite 或其他庫來填充所需大小的紋理資料。

該類在內部使用 Thread 生成紋理資料,因此如果生成過程尚未完成,Texture2D.get_image() 可能會返回 null。在這種情況下,需要等待紋理生成後再存取圖像和生成的位元組資料:

var texture = NoiseTexture3D.new()
texture.noise = FastNoiseLite.new()
await texture.changed
var data = texture.get_data()

屬性

Gradient

color_ramp

int

depth

64

int

height

64

bool

invert

false

Noise

noise

bool

normalize

true

bool

seamless

false

float

seamless_blend_skirt

0.1

int

width

64


屬性說明

Gradient color_ramp 🔗

Gradient,用於將每個圖元的亮度對應到一個顏色值。


int depth = 64 🔗

  • void set_depth(value: int)

  • int get_depth()

生成的紋理的深度(單位為圖元)。


int height = 64 🔗

  • void set_height(value: int)

  • int get_height()

生成的紋理的高度(單位為圖元)。


bool invert = false 🔗

  • void set_invert(value: bool)

  • bool get_invert()

如果為 true,則反轉該雜訊紋理。白變黑,黑變白。


Noise noise 🔗

Noise 物件的實例。


bool normalize = true 🔗

  • void set_normalize(value: bool)

  • bool is_normalized()

如果為 true,來自雜訊產生器的雜訊圖像,將被正規化到範圍 0.01.0

關閉正規化會影響對比度,並允許生成非重複的可平鋪雜訊紋理。


bool seamless = false 🔗

  • void set_seamless(value: bool)

  • bool get_seamless()

如果為 true,則從 Noise 資源請求無縫紋理。

注意:與非無縫雜訊相比,無縫雜訊紋理可能需要更長的時間來生成,並且/或者可能具有較低的對比度,具體取決於所使用的 Noise 資源。這是因為一些實作使用更高的維度來生成無縫雜訊。

注意:預設的 FastNoiseLite 實作在生成無縫紋理時使用退回路徑。如果使用的 widthheightdepth 小於預設值,你可能需要通過增大 seamless_blend_skirt 來讓無縫混合更高效。


float seamless_blend_skirt = 0.1 🔗

  • void set_seamless_blend_skirt(value: float)

  • float get_seamless_blend_skirt()

用於無縫紋理生成的預設/退回實作。它決定接縫混合的距離。較高的值可能會導致較少的細節和對比度。詳情見 Noise

注意:如果使用的 widthheightdepth 小於預設值,你可能需要通過增大 seamless_blend_skirt 來讓無縫混合更高效。


int width = 64 🔗

  • void set_width(value: int)

  • int get_width()

生成的紋理的寬度(單位為圖元)。