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.
Checking the stable version of the documentation...
ReflectionProbe
繼承: VisualInstance3D < Node3D < Node < Object
捕捉某個位置周圍的環境,用於快速建立準確的反射。
說明
Captures its surroundings as a cubemap, and stores versions of it with increasing levels of blur to simulate different material roughnesses.
The ReflectionProbe is used to create high-quality reflections at a low performance cost (when update_mode is UPDATE_ONCE). ReflectionProbes can be blended together and with the rest of the scene smoothly. ReflectionProbes can also be combined with VoxelGI, SDFGI (Environment.sdfgi_enabled) and screen-space reflections (Environment.ssr_enabled) to get more accurate reflections in specific areas. ReflectionProbes render all objects within their cull_mask, so updating them can be quite expensive. It is best to update them once with the important static objects and then leave them as-is.
Note: Unlike VoxelGI and SDFGI, ReflectionProbes only source their environment from a WorldEnvironment node. If you specify an Environment resource within a Camera3D node, it will be ignored by the ReflectionProbe. This can lead to incorrect lighting within the ReflectionProbe.
Note: When using the Mobile rendering method, only 8 reflection probes can be displayed on each mesh resource, while the Compatibility rendering method only supports up to 2 reflection probes on each mesh. Attempting to display more than 8 reflection probes on a single mesh resource using the Mobile renderer will result in reflection probes flickering in and out as the camera moves, while the Compatibility renderer will not render any additional probes if more than 2 reflection probes are being used.
Note: When using the Mobile rendering method, reflection probes will only correctly affect meshes whose visibility AABB intersects with the reflection probe's AABB. If using a shader to deform the mesh in a way that makes it go outside its AABB, GeometryInstance3D.extra_cull_margin must be increased on the mesh. Otherwise, the reflection probe may not be visible on the mesh.
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
列舉
enum UpdateMode: 🔗
UpdateMode UPDATE_ONCE = 0
在下一影格更新一次探查(建議大多數物件使用)。對應的輻照度貼圖會在後續六影格中陸續生成。更新所花費的時間比 UPDATE_ALWAYS 多,但消耗的性能比它少、產生的反射品質也更高。ReflectionProbe 的變換發生變化時也會進行更新,但不會在周圍幾何體變化時更新。你可以通過將該 ReflectionProbe 在任意方向上進行小幅度移動來強制更新 ReflectionProbe。
UpdateMode UPDATE_ALWAYS = 1
每一影格都更新該探查。可以為快速移動的物件(如汽車)提供更好的結果。然而,帶來的性能消耗也是顯著的。因此,建議同一個場景中最多只使用一個 UPDATE_ALWAYS 的 ReflectionProbe。其他用途請使用 UPDATE_ONCE。
enum AmbientMode: 🔗
AmbientMode AMBIENT_DISABLED = 0
不在 ReflectionProbe 的大小為 size 的框內部套用環境光照。
AmbientMode AMBIENT_ENVIRONMENT = 1
在 ReflectionProbe 的大小為 size 的框內部套用自動來源的環境光照。
AmbientMode AMBIENT_COLOR = 2
在 ReflectionProbe 的大小為 size 的框內部套用自訂環境光照。見 ambient_color 和 ambient_color_energy。
屬性說明
Color ambient_color = Color(0, 0, 0, 1) 🔗
ReflectionProbe 的大小為 size 的框中使用的自訂環境光顏色。僅在 ambient_mode 為 AMBIENT_COLOR 時有效。
float ambient_color_energy = 1.0 🔗
ReflectionProbe 的大小為 size 的框中使用的自訂環境光顏色能量。僅在 ambient_mode 為 AMBIENT_COLOR 時有效。
AmbientMode ambient_mode = 1 🔗
void set_ambient_mode(value: AmbientMode)
AmbientMode get_ambient_mode()
ReflectionProbe 的大小為 size 的框中使用的環境光顏色。環境光顏色會和其他 ReflectionProbe 和場景(ReflectionProbe 的大小為 size 的框之外)的其他部分進行平滑混合。
Defines the distance in meters over which a probe blends into the scene.
為 true 時將啟用箱體投影。通過根據相機的位置偏移反射中心,這使得在矩形房間中的反射看起來更正確。
注意:為了更好地適應未與網格對齊的區域,你可以旋轉 ReflectionProbe 節點。
Sets the cull mask which determines what objects are drawn by this probe. Every VisualInstance3D with a layer included in this cull mask will be rendered by the probe. It is best to only include large objects which are likely to take up a lot of space in the reflection in order to save on rendering cost.
This can also be used to prevent an object from reflecting upon itself (for instance, a ReflectionProbe centered on a vehicle).
如果為 true,則在反射探測中計算陰影。這使得反射探查算繪更慢;如果想禁用它,可以使用 UPDATE_ALWAYS update_mode。
定義反射強度。
如果為 true,則反射將忽略天空的貢獻。
物件在被剔除之前可以距該 ReflectionProbe 的最大距離。減少它可以提高性能,尤其是在使用 UPDATE_ALWAYS 作為 update_mode 時。
注意:最大反射距離始終至少等於探查的範圍。這意味著減少 max_distance 並不總是會從反射中剔除物件,尤其是在反射探查由 size 定義的框已經很大的情況下。
float mesh_lod_threshold = 1.0 🔗
用於在 ReflectionProbe 內算繪網格的自動 LOD 偏置(這類似於 Viewport.mesh_lod_threshold)。較高的值將使用生成了 LOD 變化的不太詳細的網格版本。如果設定為 0.0,則自動 LOD 將被禁用。增加 mesh_lod_threshold 以犧牲幾何細節為代價提高性能,尤其是在使用 UPDATE_ALWAYS 的 update_mode 時。
注意:mesh_lod_threshold 不影響 GeometryInstance3D 可見性範圍(也稱為“手動”LOD 或分層 LOD)。
Vector3 origin_offset = Vector3(0, 0, 0) 🔗
設定當該 ReflectionProbe 處於 box_projection 模式時要使用的原點偏移量。這可以被設定為一個非零值,以確保反射適合矩形房間,同時減少“妨礙”反射的物件數量。
int reflection_mask = 1048575 🔗
Sets the reflection mask which determines what objects have reflections applied from this probe. Every VisualInstance3D with a layer included in this reflection mask will have reflections applied from this probe. See also cull_mask, which can be used to exclude objects from appearing in the reflection while still making them affected by the ReflectionProbe.
Vector3 size = Vector3(20, 20, 20) 🔗
反射探查的大小。大小越大,探查覆蓋的空間就越大,這將降低感知的解析度。最好將大小保持在需要的大小。
注意:為了更好地適應未與網格對齊的區域,可以旋轉 ReflectionProbe 節點。
UpdateMode update_mode = 0 🔗
void set_update_mode(value: UpdateMode)
UpdateMode get_update_mode()
設定該 ReflectionProbe 的更新頻率。可以是 UPDATE_ONCE 或 UPDATE_ALWAYS。