class_reflectionprobe.rst 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/ReflectionProbe.xml.
  6. .. _class_ReflectionProbe:
  7. ReflectionProbe
  8. ===============
  9. **Inherits:** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Captures its surroundings to create fast, accurate reflections from a given point.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Captures its surroundings as a cubemap, and stores versions of it with increasing levels of blur to simulate different material roughnesses.
  15. The **ReflectionProbe** is used to create high-quality reflections at a low performance cost (when :ref:`update_mode<class_ReflectionProbe_property_update_mode>` is :ref:`UPDATE_ONCE<class_ReflectionProbe_constant_UPDATE_ONCE>`). **ReflectionProbe**\ s can be blended together and with the rest of the scene smoothly. **ReflectionProbe**\ s can also be combined with :ref:`VoxelGI<class_VoxelGI>`, SDFGI (:ref:`Environment.sdfgi_enabled<class_Environment_property_sdfgi_enabled>`) and screen-space reflections (:ref:`Environment.ssr_enabled<class_Environment_property_ssr_enabled>`) to get more accurate reflections in specific areas. **ReflectionProbe**\ s render all objects within their :ref:`cull_mask<class_ReflectionProbe_property_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.
  16. \ **Note:** Unlike :ref:`VoxelGI<class_VoxelGI>` and SDFGI, **ReflectionProbe**\ s only source their environment from a :ref:`WorldEnvironment<class_WorldEnvironment>` node. If you specify an :ref:`Environment<class_Environment>` resource within a :ref:`Camera3D<class_Camera3D>` node, it will be ignored by the **ReflectionProbe**. This can lead to incorrect lighting within the **ReflectionProbe**.
  17. \ **Note:** Reflection probes are only supported in the Forward+ and Mobile rendering methods, not Compatibility. When using the Mobile rendering method, only 8 reflection probes can be displayed on each mesh resource. Attempting to display more than 8 reflection probes on a single mesh resource will result in reflection probes flickering in and out as the camera moves.
  18. \ **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, :ref:`GeometryInstance3D.extra_cull_margin<class_GeometryInstance3D_property_extra_cull_margin>` must be increased on the mesh. Otherwise, the reflection probe may not be visible on the mesh.
  19. .. rst-class:: classref-introduction-group
  20. Tutorials
  21. ---------
  22. - :doc:`Reflection probes <../tutorials/3d/global_illumination/reflection_probes>`
  23. .. rst-class:: classref-reftable-group
  24. Properties
  25. ----------
  26. .. table::
  27. :widths: auto
  28. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  29. | :ref:`Color<class_Color>` | :ref:`ambient_color<class_ReflectionProbe_property_ambient_color>` | ``Color(0, 0, 0, 1)`` |
  30. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  31. | :ref:`float<class_float>` | :ref:`ambient_color_energy<class_ReflectionProbe_property_ambient_color_energy>` | ``1.0`` |
  32. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  33. | :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` | :ref:`ambient_mode<class_ReflectionProbe_property_ambient_mode>` | ``1`` |
  34. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`box_projection<class_ReflectionProbe_property_box_projection>` | ``false`` |
  36. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  37. | :ref:`int<class_int>` | :ref:`cull_mask<class_ReflectionProbe_property_cull_mask>` | ``1048575`` |
  38. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`enable_shadows<class_ReflectionProbe_property_enable_shadows>` | ``false`` |
  40. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  41. | :ref:`float<class_float>` | :ref:`intensity<class_ReflectionProbe_property_intensity>` | ``1.0`` |
  42. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`interior<class_ReflectionProbe_property_interior>` | ``false`` |
  44. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  45. | :ref:`float<class_float>` | :ref:`max_distance<class_ReflectionProbe_property_max_distance>` | ``0.0`` |
  46. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  47. | :ref:`float<class_float>` | :ref:`mesh_lod_threshold<class_ReflectionProbe_property_mesh_lod_threshold>` | ``1.0`` |
  48. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  49. | :ref:`Vector3<class_Vector3>` | :ref:`origin_offset<class_ReflectionProbe_property_origin_offset>` | ``Vector3(0, 0, 0)`` |
  50. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  51. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_ReflectionProbe_property_size>` | ``Vector3(20, 20, 20)`` |
  52. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  53. | :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` | :ref:`update_mode<class_ReflectionProbe_property_update_mode>` | ``0`` |
  54. +------------------------------------------------------+----------------------------------------------------------------------------------+-------------------------+
  55. .. rst-class:: classref-section-separator
  56. ----
  57. .. rst-class:: classref-descriptions-group
  58. Enumerations
  59. ------------
  60. .. _enum_ReflectionProbe_UpdateMode:
  61. .. rst-class:: classref-enumeration
  62. enum **UpdateMode**:
  63. .. _class_ReflectionProbe_constant_UPDATE_ONCE:
  64. .. rst-class:: classref-enumeration-constant
  65. :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` **UPDATE_ONCE** = ``0``
  66. Update the probe once on the next frame (recommended for most objects). The corresponding radiance map will be generated over the following six frames. This takes more time to update than :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>`, but it has a lower performance cost and can result in higher-quality reflections. The ReflectionProbe is updated when its transform changes, but not when nearby geometry changes. You can force a **ReflectionProbe** update by moving the **ReflectionProbe** slightly in any direction.
  67. .. _class_ReflectionProbe_constant_UPDATE_ALWAYS:
  68. .. rst-class:: classref-enumeration-constant
  69. :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` **UPDATE_ALWAYS** = ``1``
  70. Update the probe every frame. This provides better results for fast-moving dynamic objects (such as cars). However, it has a significant performance cost. Due to the cost, it's recommended to only use one ReflectionProbe with :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>` at most per scene. For all other use cases, use :ref:`UPDATE_ONCE<class_ReflectionProbe_constant_UPDATE_ONCE>`.
  71. .. rst-class:: classref-item-separator
  72. ----
  73. .. _enum_ReflectionProbe_AmbientMode:
  74. .. rst-class:: classref-enumeration
  75. enum **AmbientMode**:
  76. .. _class_ReflectionProbe_constant_AMBIENT_DISABLED:
  77. .. rst-class:: classref-enumeration-constant
  78. :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` **AMBIENT_DISABLED** = ``0``
  79. Do not apply any ambient lighting inside the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`.
  80. .. _class_ReflectionProbe_constant_AMBIENT_ENVIRONMENT:
  81. .. rst-class:: classref-enumeration-constant
  82. :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` **AMBIENT_ENVIRONMENT** = ``1``
  83. Apply automatically-sourced environment lighting inside the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`.
  84. .. _class_ReflectionProbe_constant_AMBIENT_COLOR:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` **AMBIENT_COLOR** = ``2``
  87. Apply custom ambient lighting inside the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`. See :ref:`ambient_color<class_ReflectionProbe_property_ambient_color>` and :ref:`ambient_color_energy<class_ReflectionProbe_property_ambient_color_energy>`.
  88. .. rst-class:: classref-section-separator
  89. ----
  90. .. rst-class:: classref-descriptions-group
  91. Property Descriptions
  92. ---------------------
  93. .. _class_ReflectionProbe_property_ambient_color:
  94. .. rst-class:: classref-property
  95. :ref:`Color<class_Color>` **ambient_color** = ``Color(0, 0, 0, 1)``
  96. .. rst-class:: classref-property-setget
  97. - void **set_ambient_color** **(** :ref:`Color<class_Color>` value **)**
  98. - :ref:`Color<class_Color>` **get_ambient_color** **(** **)**
  99. The custom ambient color to use within the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`. Only effective if :ref:`ambient_mode<class_ReflectionProbe_property_ambient_mode>` is :ref:`AMBIENT_COLOR<class_ReflectionProbe_constant_AMBIENT_COLOR>`.
  100. .. rst-class:: classref-item-separator
  101. ----
  102. .. _class_ReflectionProbe_property_ambient_color_energy:
  103. .. rst-class:: classref-property
  104. :ref:`float<class_float>` **ambient_color_energy** = ``1.0``
  105. .. rst-class:: classref-property-setget
  106. - void **set_ambient_color_energy** **(** :ref:`float<class_float>` value **)**
  107. - :ref:`float<class_float>` **get_ambient_color_energy** **(** **)**
  108. The custom ambient color energy to use within the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`. Only effective if :ref:`ambient_mode<class_ReflectionProbe_property_ambient_mode>` is :ref:`AMBIENT_COLOR<class_ReflectionProbe_constant_AMBIENT_COLOR>`.
  109. .. rst-class:: classref-item-separator
  110. ----
  111. .. _class_ReflectionProbe_property_ambient_mode:
  112. .. rst-class:: classref-property
  113. :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` **ambient_mode** = ``1``
  114. .. rst-class:: classref-property-setget
  115. - void **set_ambient_mode** **(** :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` value **)**
  116. - :ref:`AmbientMode<enum_ReflectionProbe_AmbientMode>` **get_ambient_mode** **(** **)**
  117. The ambient color to use within the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`. The ambient color will smoothly blend with other **ReflectionProbe**\ s and the rest of the scene (outside the **ReflectionProbe**'s box defined by its :ref:`size<class_ReflectionProbe_property_size>`).
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_ReflectionProbe_property_box_projection:
  121. .. rst-class:: classref-property
  122. :ref:`bool<class_bool>` **box_projection** = ``false``
  123. .. rst-class:: classref-property-setget
  124. - void **set_enable_box_projection** **(** :ref:`bool<class_bool>` value **)**
  125. - :ref:`bool<class_bool>` **is_box_projection_enabled** **(** **)**
  126. If ``true``, enables box projection. This makes reflections look more correct in rectangle-shaped rooms by offsetting the reflection center depending on the camera's location.
  127. \ **Note:** To better fit rectangle-shaped rooms that are not aligned to the grid, you can rotate the **ReflectionProbe** node.
  128. .. rst-class:: classref-item-separator
  129. ----
  130. .. _class_ReflectionProbe_property_cull_mask:
  131. .. rst-class:: classref-property
  132. :ref:`int<class_int>` **cull_mask** = ``1048575``
  133. .. rst-class:: classref-property-setget
  134. - void **set_cull_mask** **(** :ref:`int<class_int>` value **)**
  135. - :ref:`int<class_int>` **get_cull_mask** **(** **)**
  136. Sets the cull mask which determines what objects are drawn by this probe. Every :ref:`VisualInstance3D<class_VisualInstance3D>` with a layer included in this cull mask will be rendered by the probe. To improve performance, it is best to only include large objects which are likely to take up a lot of space in the reflection.
  137. .. rst-class:: classref-item-separator
  138. ----
  139. .. _class_ReflectionProbe_property_enable_shadows:
  140. .. rst-class:: classref-property
  141. :ref:`bool<class_bool>` **enable_shadows** = ``false``
  142. .. rst-class:: classref-property-setget
  143. - void **set_enable_shadows** **(** :ref:`bool<class_bool>` value **)**
  144. - :ref:`bool<class_bool>` **are_shadows_enabled** **(** **)**
  145. If ``true``, computes shadows in the reflection probe. This makes the reflection probe slower to render; you may want to disable this if using the :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>` :ref:`update_mode<class_ReflectionProbe_property_update_mode>`.
  146. .. rst-class:: classref-item-separator
  147. ----
  148. .. _class_ReflectionProbe_property_intensity:
  149. .. rst-class:: classref-property
  150. :ref:`float<class_float>` **intensity** = ``1.0``
  151. .. rst-class:: classref-property-setget
  152. - void **set_intensity** **(** :ref:`float<class_float>` value **)**
  153. - :ref:`float<class_float>` **get_intensity** **(** **)**
  154. Defines the reflection intensity. Intensity modulates the strength of the reflection.
  155. .. rst-class:: classref-item-separator
  156. ----
  157. .. _class_ReflectionProbe_property_interior:
  158. .. rst-class:: classref-property
  159. :ref:`bool<class_bool>` **interior** = ``false``
  160. .. rst-class:: classref-property-setget
  161. - void **set_as_interior** **(** :ref:`bool<class_bool>` value **)**
  162. - :ref:`bool<class_bool>` **is_set_as_interior** **(** **)**
  163. If ``true``, reflections will ignore sky contribution.
  164. .. rst-class:: classref-item-separator
  165. ----
  166. .. _class_ReflectionProbe_property_max_distance:
  167. .. rst-class:: classref-property
  168. :ref:`float<class_float>` **max_distance** = ``0.0``
  169. .. rst-class:: classref-property-setget
  170. - void **set_max_distance** **(** :ref:`float<class_float>` value **)**
  171. - :ref:`float<class_float>` **get_max_distance** **(** **)**
  172. The maximum distance away from the **ReflectionProbe** an object can be before it is culled. Decrease this to improve performance, especially when using the :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>` :ref:`update_mode<class_ReflectionProbe_property_update_mode>`.
  173. \ **Note:** The maximum reflection distance is always at least equal to the probe's extents. This means that decreasing :ref:`max_distance<class_ReflectionProbe_property_max_distance>` will not always cull objects from reflections, especially if the reflection probe's box defined by its :ref:`size<class_ReflectionProbe_property_size>` is already large.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_ReflectionProbe_property_mesh_lod_threshold:
  177. .. rst-class:: classref-property
  178. :ref:`float<class_float>` **mesh_lod_threshold** = ``1.0``
  179. .. rst-class:: classref-property-setget
  180. - void **set_mesh_lod_threshold** **(** :ref:`float<class_float>` value **)**
  181. - :ref:`float<class_float>` **get_mesh_lod_threshold** **(** **)**
  182. The automatic LOD bias to use for meshes rendered within the **ReflectionProbe** (this is analog to :ref:`Viewport.mesh_lod_threshold<class_Viewport_property_mesh_lod_threshold>`). Higher values will use less detailed versions of meshes that have LOD variations generated. If set to ``0.0``, automatic LOD is disabled. Increase :ref:`mesh_lod_threshold<class_ReflectionProbe_property_mesh_lod_threshold>` to improve performance at the cost of geometry detail, especially when using the :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>` :ref:`update_mode<class_ReflectionProbe_property_update_mode>`.
  183. \ **Note:** :ref:`mesh_lod_threshold<class_ReflectionProbe_property_mesh_lod_threshold>` does not affect :ref:`GeometryInstance3D<class_GeometryInstance3D>` visibility ranges (also known as "manual" LOD or hierarchical LOD).
  184. .. rst-class:: classref-item-separator
  185. ----
  186. .. _class_ReflectionProbe_property_origin_offset:
  187. .. rst-class:: classref-property
  188. :ref:`Vector3<class_Vector3>` **origin_offset** = ``Vector3(0, 0, 0)``
  189. .. rst-class:: classref-property-setget
  190. - void **set_origin_offset** **(** :ref:`Vector3<class_Vector3>` value **)**
  191. - :ref:`Vector3<class_Vector3>` **get_origin_offset** **(** **)**
  192. Sets the origin offset to be used when this **ReflectionProbe** is in :ref:`box_projection<class_ReflectionProbe_property_box_projection>` mode. This can be set to a non-zero value to ensure a reflection fits a rectangle-shaped room, while reducing the number of objects that "get in the way" of the reflection.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. _class_ReflectionProbe_property_size:
  196. .. rst-class:: classref-property
  197. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(20, 20, 20)``
  198. .. rst-class:: classref-property-setget
  199. - void **set_size** **(** :ref:`Vector3<class_Vector3>` value **)**
  200. - :ref:`Vector3<class_Vector3>` **get_size** **(** **)**
  201. The size of the reflection probe. The larger the size, the more space covered by the probe, which will lower the perceived resolution. It is best to keep the size only as large as you need it.
  202. \ **Note:** To better fit areas that are not aligned to the grid, you can rotate the **ReflectionProbe** node.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. _class_ReflectionProbe_property_update_mode:
  206. .. rst-class:: classref-property
  207. :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` **update_mode** = ``0``
  208. .. rst-class:: classref-property-setget
  209. - void **set_update_mode** **(** :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` value **)**
  210. - :ref:`UpdateMode<enum_ReflectionProbe_UpdateMode>` **get_update_mode** **(** **)**
  211. Sets how frequently the **ReflectionProbe** is updated. Can be :ref:`UPDATE_ONCE<class_ReflectionProbe_constant_UPDATE_ONCE>` or :ref:`UPDATE_ALWAYS<class_ReflectionProbe_constant_UPDATE_ALWAYS>`.
  212. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  213. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  214. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  215. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  216. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  217. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  218. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`