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.

RDSamplerState

繼承: RefCounted < Object

取樣器狀態(由 RenderingDevice 使用)。

說明

這個物件由 RenderingDevice 使用。

屬性

float

anisotropy_max

1.0

SamplerBorderColor

border_color

2

CompareOperator

compare_op

7

bool

enable_compare

false

float

lod_bias

0.0

SamplerFilter

mag_filter

0

float

max_lod

1e+20

SamplerFilter

min_filter

0

float

min_lod

0.0

SamplerFilter

mip_filter

0

SamplerRepeatMode

repeat_u

2

SamplerRepeatMode

repeat_v

2

SamplerRepeatMode

repeat_w

2

bool

unnormalized_uvw

false

bool

use_anisotropy

false


屬性說明

float anisotropy_max = 1.0 🔗

  • void set_anisotropy_max(value: float)

  • float get_anisotropy_max()

取樣時能夠使用的最大各向異性。僅在 use_anisotropytrue 時有效。值越高,傾斜角度下得到的取樣越銳利,但性能開銷也越大(由於顯存頻寬的原因)。這個值可能受到使用的圖形硬體的限制。大多數圖形硬體最多僅支援 16.0

如果 anisotropy_max1.0,則會強制禁用各向異性,即便 use_anisotropytrue


SamplerBorderColor border_color = 2 🔗

對取樣器範圍外進行取樣,並且 repeat_urepeat_vrepeat_w 的模式禁用了重複時,返回的邊框顏色。


CompareOperator compare_op = 7 🔗

要使用的比較運算。僅在 enable_comparetrue 時有效。


bool enable_compare = false 🔗

  • void set_enable_compare(value: bool)

  • bool get_enable_compare()

如果為 true,則返回值基於 compare_op 定義的比較運算。這種做法基於硬體,因此比手動在著色器中執行要快。例如,算繪陰影貼圖時就會對陰影取樣器的深度值進行比較運算。


float lod_bias = 0.0 🔗

  • void set_lod_bias(value: float)

  • float get_lod_bias()

要使用的 mipmap LOD 偏置。正值會讓取樣器在給定距離處更模糊,而負值會讓取樣器在給定距離處更銳利(有可能看上去會很顆粒化)。推薦值在 -0.50.0 之間。僅在取樣器的 mipmap 可用時有效。


SamplerFilter mag_filter = 0 🔗

The sampler's magnification filter. It is the filtering method used when sampling texels that appear bigger than on-screen pixels.


float max_lod = 1e+20 🔗

  • void set_max_lod(value: float)

  • float get_max_lod()

用於顯示的最大 mipmap LOD 偏置(最低解析度)。僅在取樣器有 mipmap 可用時有效。


SamplerFilter min_filter = 0 🔗

The sampler's minification filter. It is the filtering method used when sampling texels that appear smaller than on-screen pixels.


float min_lod = 0.0 🔗

  • void set_min_lod(value: float)

  • float get_min_lod()

用於顯示的最小 mipmap LOD 偏置(最高解析度)。僅在取樣器有 mipmap 可用時有效。


SamplerFilter mip_filter = 0 🔗

Mipmap 使用的篩選方法。


SamplerRepeatMode repeat_u = 2 🔗

沿著 UV 座標 U 軸的重複模式。影響取樣超出 UV 邊界時的返回值。


SamplerRepeatMode repeat_v = 2 🔗

沿著 UV 座標 V 軸的重複模式。影響取樣超出 UV 邊界時的返回值。


SamplerRepeatMode repeat_w = 2 🔗

沿著 UV 座標 W 軸的重複模式。影響取樣超出 UV 邊界時的返回值。僅對 3D 取樣器有效。


bool unnormalized_uvw = false 🔗

  • void set_unnormalized_uvw(value: bool)

  • bool get_unnormalized_uvw()

If true, the texture will be sampled with coordinates ranging from 0 to the texture's resolution. Otherwise, the coordinates will be normalized and range from 0 to 1.


bool use_anisotropy = false 🔗

  • void set_use_anisotropy(value: bool)

  • bool get_use_anisotropy()

如果為 true,則執行各向異性取樣。