class_giprobe.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the GIProbe.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_GIProbe:
  6. GIProbe
  7. =======
  8. **Inherits:** :ref:`VisualInstance<class_VisualInstance>` **<** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  9. Real-time global illumination (GI) probe.
  10. Description
  11. -----------
  12. ``GIProbe``\ s are used to provide high-quality real-time indirect light to scenes. They precompute the effect of objects that emit light and the effect of static geometry to simulate the behavior of complex light in real-time. ``GIProbe``\ s need to be baked before using, however, once baked, dynamic objects will receive light from them. Further, lights can be fully dynamic or baked.
  13. Having ``GIProbe``\ s in a scene can be expensive, the quality of the probe can be turned down in exchange for better performance in the :ref:`ProjectSettings<class_ProjectSettings>` using :ref:`ProjectSettings.rendering/quality/voxel_cone_tracing/high_quality<class_ProjectSettings_property_rendering/quality/voxel_cone_tracing/high_quality>`.
  14. **Note:** Meshes should have sufficiently thick walls to avoid light leaks (avoid one-sided walls). For interior levels, enclose your level geometry in a sufficiently large box and bridge the loops to close the mesh.
  15. **Note:** Due to a renderer limitation, emissive :ref:`ShaderMaterial<class_ShaderMaterial>`\ s cannot emit light when used in a ``GIProbe``. Only emissive :ref:`SpatialMaterial<class_SpatialMaterial>`\ s can emit light in a ``GIProbe``.
  16. Tutorials
  17. ---------
  18. - :doc:`../tutorials/3d/gi_probes`
  19. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`_
  20. Properties
  21. ----------
  22. +---------------------------------------+------------------------------------------------------------+---------------------------+
  23. | :ref:`float<class_float>` | :ref:`bias<class_GIProbe_property_bias>` | ``1.5`` |
  24. +---------------------------------------+------------------------------------------------------------+---------------------------+
  25. | :ref:`bool<class_bool>` | :ref:`compress<class_GIProbe_property_compress>` | ``false`` |
  26. +---------------------------------------+------------------------------------------------------------+---------------------------+
  27. | :ref:`GIProbeData<class_GIProbeData>` | :ref:`data<class_GIProbe_property_data>` | |
  28. +---------------------------------------+------------------------------------------------------------+---------------------------+
  29. | :ref:`int<class_int>` | :ref:`dynamic_range<class_GIProbe_property_dynamic_range>` | ``4`` |
  30. +---------------------------------------+------------------------------------------------------------+---------------------------+
  31. | :ref:`float<class_float>` | :ref:`energy<class_GIProbe_property_energy>` | ``1.0`` |
  32. +---------------------------------------+------------------------------------------------------------+---------------------------+
  33. | :ref:`Vector3<class_Vector3>` | :ref:`extents<class_GIProbe_property_extents>` | ``Vector3( 10, 10, 10 )`` |
  34. +---------------------------------------+------------------------------------------------------------+---------------------------+
  35. | :ref:`bool<class_bool>` | :ref:`interior<class_GIProbe_property_interior>` | ``false`` |
  36. +---------------------------------------+------------------------------------------------------------+---------------------------+
  37. | :ref:`float<class_float>` | :ref:`normal_bias<class_GIProbe_property_normal_bias>` | ``0.0`` |
  38. +---------------------------------------+------------------------------------------------------------+---------------------------+
  39. | :ref:`float<class_float>` | :ref:`propagation<class_GIProbe_property_propagation>` | ``0.7`` |
  40. +---------------------------------------+------------------------------------------------------------+---------------------------+
  41. | :ref:`Subdiv<enum_GIProbe_Subdiv>` | :ref:`subdiv<class_GIProbe_property_subdiv>` | ``1`` |
  42. +---------------------------------------+------------------------------------------------------------+---------------------------+
  43. Methods
  44. -------
  45. +------+----------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`bake<class_GIProbe_method_bake>` **(** :ref:`Node<class_Node>` from_node=null, :ref:`bool<class_bool>` create_visual_debug=false **)** |
  47. +------+----------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`debug_bake<class_GIProbe_method_debug_bake>` **(** **)** |
  49. +------+----------------------------------------------------------------------------------------------------------------------------------------------+
  50. Enumerations
  51. ------------
  52. .. _enum_GIProbe_Subdiv:
  53. .. _class_GIProbe_constant_SUBDIV_64:
  54. .. _class_GIProbe_constant_SUBDIV_128:
  55. .. _class_GIProbe_constant_SUBDIV_256:
  56. .. _class_GIProbe_constant_SUBDIV_512:
  57. .. _class_GIProbe_constant_SUBDIV_MAX:
  58. enum **Subdiv**:
  59. - **SUBDIV_64** = **0** --- Use 64 subdivisions. This is the lowest quality setting, but the fastest. Use it if you can, but especially use it on lower-end hardware.
  60. - **SUBDIV_128** = **1** --- Use 128 subdivisions. This is the default quality setting.
  61. - **SUBDIV_256** = **2** --- Use 256 subdivisions.
  62. - **SUBDIV_512** = **3** --- Use 512 subdivisions. This is the highest quality setting, but the slowest. On lower-end hardware this could cause the GPU to stall.
  63. - **SUBDIV_MAX** = **4** --- Represents the size of the :ref:`Subdiv<enum_GIProbe_Subdiv>` enum.
  64. Property Descriptions
  65. ---------------------
  66. .. _class_GIProbe_property_bias:
  67. - :ref:`float<class_float>` **bias**
  68. +-----------+-----------------+
  69. | *Default* | ``1.5`` |
  70. +-----------+-----------------+
  71. | *Setter* | set_bias(value) |
  72. +-----------+-----------------+
  73. | *Getter* | get_bias() |
  74. +-----------+-----------------+
  75. Offsets the lookup of the light contribution from the ``GIProbe``. This can be used to avoid self-shadowing, but may introduce light leaking at higher values. This and :ref:`normal_bias<class_GIProbe_property_normal_bias>` should be played around with to minimize self-shadowing and light leaking.
  76. **Note:** ``bias`` should usually be above 1.0 as that is the size of the voxels.
  77. ----
  78. .. _class_GIProbe_property_compress:
  79. - :ref:`bool<class_bool>` **compress**
  80. +-----------+---------------------+
  81. | *Default* | ``false`` |
  82. +-----------+---------------------+
  83. | *Setter* | set_compress(value) |
  84. +-----------+---------------------+
  85. | *Getter* | is_compressed() |
  86. +-----------+---------------------+
  87. If ``true``, the data for this ``GIProbe`` will be compressed. Compression saves space, but results in far worse visual quality.
  88. ----
  89. .. _class_GIProbe_property_data:
  90. - :ref:`GIProbeData<class_GIProbeData>` **data**
  91. +----------+-----------------------+
  92. | *Setter* | set_probe_data(value) |
  93. +----------+-----------------------+
  94. | *Getter* | get_probe_data() |
  95. +----------+-----------------------+
  96. The :ref:`GIProbeData<class_GIProbeData>` resource that holds the data for this ``GIProbe``.
  97. ----
  98. .. _class_GIProbe_property_dynamic_range:
  99. - :ref:`int<class_int>` **dynamic_range**
  100. +-----------+--------------------------+
  101. | *Default* | ``4`` |
  102. +-----------+--------------------------+
  103. | *Setter* | set_dynamic_range(value) |
  104. +-----------+--------------------------+
  105. | *Getter* | get_dynamic_range() |
  106. +-----------+--------------------------+
  107. The maximum brightness that the ``GIProbe`` will recognize. Brightness will be scaled within this range.
  108. ----
  109. .. _class_GIProbe_property_energy:
  110. - :ref:`float<class_float>` **energy**
  111. +-----------+-------------------+
  112. | *Default* | ``1.0`` |
  113. +-----------+-------------------+
  114. | *Setter* | set_energy(value) |
  115. +-----------+-------------------+
  116. | *Getter* | get_energy() |
  117. +-----------+-------------------+
  118. Energy multiplier. Makes the lighting contribution from the ``GIProbe`` brighter.
  119. ----
  120. .. _class_GIProbe_property_extents:
  121. - :ref:`Vector3<class_Vector3>` **extents**
  122. +-----------+---------------------------+
  123. | *Default* | ``Vector3( 10, 10, 10 )`` |
  124. +-----------+---------------------------+
  125. | *Setter* | set_extents(value) |
  126. +-----------+---------------------------+
  127. | *Getter* | get_extents() |
  128. +-----------+---------------------------+
  129. The size of the area covered by the ``GIProbe``. If you make the extents larger without increasing the subdivisions with :ref:`subdiv<class_GIProbe_property_subdiv>`, the size of each cell will increase and result in lower detailed lighting.
  130. ----
  131. .. _class_GIProbe_property_interior:
  132. - :ref:`bool<class_bool>` **interior**
  133. +-----------+---------------------+
  134. | *Default* | ``false`` |
  135. +-----------+---------------------+
  136. | *Setter* | set_interior(value) |
  137. +-----------+---------------------+
  138. | *Getter* | is_interior() |
  139. +-----------+---------------------+
  140. If ``true``, ignores the sky contribution when calculating lighting.
  141. ----
  142. .. _class_GIProbe_property_normal_bias:
  143. - :ref:`float<class_float>` **normal_bias**
  144. +-----------+------------------------+
  145. | *Default* | ``0.0`` |
  146. +-----------+------------------------+
  147. | *Setter* | set_normal_bias(value) |
  148. +-----------+------------------------+
  149. | *Getter* | get_normal_bias() |
  150. +-----------+------------------------+
  151. Offsets the lookup into the ``GIProbe`` based on the object's normal direction. Can be used to reduce some self-shadowing artifacts.
  152. ----
  153. .. _class_GIProbe_property_propagation:
  154. - :ref:`float<class_float>` **propagation**
  155. +-----------+------------------------+
  156. | *Default* | ``0.7`` |
  157. +-----------+------------------------+
  158. | *Setter* | set_propagation(value) |
  159. +-----------+------------------------+
  160. | *Getter* | get_propagation() |
  161. +-----------+------------------------+
  162. How much light propagates through the probe internally. A higher value allows light to spread further.
  163. ----
  164. .. _class_GIProbe_property_subdiv:
  165. - :ref:`Subdiv<enum_GIProbe_Subdiv>` **subdiv**
  166. +-----------+-------------------+
  167. | *Default* | ``1`` |
  168. +-----------+-------------------+
  169. | *Setter* | set_subdiv(value) |
  170. +-----------+-------------------+
  171. | *Getter* | get_subdiv() |
  172. +-----------+-------------------+
  173. Number of times to subdivide the grid that the ``GIProbe`` operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance.
  174. Method Descriptions
  175. -------------------
  176. .. _class_GIProbe_method_bake:
  177. - void **bake** **(** :ref:`Node<class_Node>` from_node=null, :ref:`bool<class_bool>` create_visual_debug=false **)**
  178. Bakes the effect from all :ref:`GeometryInstance<class_GeometryInstance>`\ s marked with :ref:`GeometryInstance.use_in_baked_light<class_GeometryInstance_property_use_in_baked_light>` and :ref:`Light<class_Light>`\ s marked with either :ref:`Light.BAKE_INDIRECT<class_Light_constant_BAKE_INDIRECT>` or :ref:`Light.BAKE_ALL<class_Light_constant_BAKE_ALL>`. If ``create_visual_debug`` is ``true``, after baking the light, this will generate a :ref:`MultiMesh<class_MultiMesh>` that has a cube representing each solid cell with each cube colored to the cell's albedo color. This can be used to visualize the ``GIProbe``'s data and debug any issues that may be occurring.
  179. ----
  180. .. _class_GIProbe_method_debug_bake:
  181. - void **debug_bake** **(** **)**
  182. Calls :ref:`bake<class_GIProbe_method_bake>` with ``create_visual_debug`` enabled.
  183. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  184. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  185. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`