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.

OmniLight3D

繼承: Light3D < VisualInstance3D < Node3D < Node < Object

全向光,如燈泡或蠟燭。

說明

全向光是 Light3D 的一類,可以向所有方向發射光。光隨距離而衰減,該衰減可以通過修改其能量、半徑和衰減參數來配置。

注意:使用移動算繪方式時,每個網格資源上只能顯示 8 個全向燈。嘗試在單個網格資源上顯示 8 個以上的全向燈,將導致全向燈隨著相機移動而閃爍。使用 Compatibility 算繪方式時,預設情況下每個網格資源上只能顯示 8 個全向燈,但可以通過調整 ProjectSettings.rendering/limits/opengl/max_lights_per_object 來增加。

注意:當使用 Mobile 或 Compatibility 算繪方法時,全向燈只會正確影響可見性 AABB 與該燈光的 AABB 相交的網格。如果使用了著色器將網格進行了變形,超出了 AABB 的範圍,則必須將該網格的 GeometryInstance3D.extra_cull_margin 增大。否則燈光在該網格上可能不可見。

教學

屬性

float

light_specular

0.5 (overrides Light3D)

float

omni_attenuation

1.0

float

omni_range

5.0

ShadowMode

omni_shadow_mode

1

float

shadow_normal_bias

1.0 (overrides Light3D)


列舉

enum ShadowMode: 🔗

ShadowMode SHADOW_DUAL_PARABOLOID = 0

將陰影算繪到雙抛物面紋理。比 SHADOW_CUBE 更快,但品質較差。

ShadowMode SHADOW_CUBE = 1

將陰影算繪至立方體貼圖。比 SHADOW_DUAL_PARABOLOID 更慢,但品質更高。


屬性說明

float omni_attenuation = 1.0 🔗

Controls the distance attenuation function for omnilights.

A value of 0.0 will maintain a constant brightness through most of the range, but smoothly attenuate the light at the edge of the range. Use a value of 2.0 for physically accurate lights as it results in the proper inverse square attenutation.

Note: Setting attenuation to 2.0 or higher may result in distant objects receiving minimal light, even within range. For example, with a range of 4096, an object at 100 units is attenuated by a factor of 0.0001. With a default brightness of 1, the light would not be visible at that distance.

Note: Using negative or values higher than 10.0 may lead to unexpected results.


float omni_range = 5.0 🔗

該燈光的半徑。請注意,根據使用的 omni_attenuation,有效照明區域可能看起來更小。無論使用 omni_attenuation 為何值,光線永遠不會到達該半徑之外的任何地方。

注意:omni_range 不受 Node3D.scale(無論是該燈光的縮放還是其父節點的縮放)的影響。


ShadowMode omni_shadow_mode = 1 🔗

There is currently no description for this property. Please help us by contributing one!