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.

LightmapGIData

繼承: Resource < RefCounted < Object

包含用於 LightmapGI 的烘焙光照貼圖和動態物件探測資料。

說明

LightmapGIData 包含用於 LightmapGI 的烘焙光照貼圖和動態物件探測資料。在 LightmapGI 中每當光照貼圖被烘焙時都會替換它。

屬性

TextureLayered

light_texture

Array[TextureLayered]

lightmap_textures

[]

Array[TextureLayered]

shadowmask_textures

[]

方法

void

add_user(path: NodePath, uv_scale: Rect2, slice_index: int, sub_instance: int)

void

clear_users()

int

get_user_count() const

NodePath

get_user_path(user_idx: int) const

bool

is_using_spherical_harmonics() const

void

set_uses_spherical_harmonics(uses_spherical_harmonics: bool)


列舉

enum ShadowmaskMode: 🔗

ShadowmaskMode SHADOWMASK_MODE_NONE = 0

陰影遮罩已停用。烘焙光照貼圖時不會建立陰影遮罩紋理。烘焙時會移除現有的陰影遮罩紋理。

ShadowmaskMode SHADOWMASK_MODE_REPLACE = 1

陰影遮罩已啟用。超出 DirectionalLight3D.directional_shadow_max_distance 範圍的方向陰影會使用陰影遮罩紋理渲染。範圍內的陰影只會使用即時陰影渲染。該模式能夠讓較近的即時陰影更加精確,不會出現使用高紋素大小的光照貼圖時可能出現的“模糊”效果。缺點是當相機快速移動時,即時光照和陰影遮罩之間的過渡可能會很明顯。此外,僅在陰影遮罩中烘焙陰影(沒有即時陰影)的物體在距離較近時不會顯示任何陰影。

ShadowmaskMode SHADOWMASK_MODE_OVERLAY = 2

陰影遮罩已啟用。方向陰影在渲染時會在陰影遮罩紋理上疊加即時陰影。該模式在相機快速移動時可以實現更平滑的陰影過渡,但代價是近距離的方向陰影可能會出現模糊效果(因為即時陰影與低解析度的陰影遮罩混合)。僅在陰影遮罩中烘焙陰影(沒有即時陰影)的物體在距離較近時會保持陰影。


屬性說明

TextureLayered light_texture 🔗

已棄用: The lightmap atlas can now contain multiple textures. See lightmap_textures.

由光照貼圖器生成的光照貼圖圖集紋理。


Array[TextureLayered] lightmap_textures = [] 🔗

由光照貼圖器生成的光照貼圖圖集紋理。


Array[TextureLayered] shadowmask_textures = [] 🔗

光照貼圖器生成的陰影遮罩圖集紋理。


方法說明

void add_user(path: NodePath, uv_scale: Rect2, slice_index: int, sub_instance: int) 🔗

新增一個在該 LightmapGIData 中被視為已烘焙的物件。


void clear_users() 🔗

清除在該 LightmapGIData 中被視為已烘焙的所有物件。


int get_user_count() const 🔗

返回在該 LightmapGIData 中被視為烘焙的物件的數量。


NodePath get_user_path(user_idx: int) const 🔗

返回索引 user_idx 處烘焙對象的 NodePath。


bool is_using_spherical_harmonics() const 🔗

如果為 true,則光照貼圖使用定向資訊烘焙。另請參閱 LightmapGI.directional。


void set_uses_spherical_harmonics(uses_spherical_harmonics: bool) 🔗

如果 uses_spherical_harmonics 為 true,則告訴引擎將光照貼圖資料視為使用了定向資訊烘焙的。

注意:在已烘焙的光照貼圖上更改此值不會導致再次烘焙它們。這意味著在再次烘焙光照貼圖之前,材質外觀將看起來不正確,在這種情況下,此處設定的值將被丟棄,因為整個 LightmapGIData 資源被光照貼圖器替換。