class_voxelgi.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/VoxelGI.xml.
  6. .. _class_VoxelGI:
  7. VoxelGI
  8. =======
  9. **Inherits:** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. Real-time global illumination (GI) probe.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **VoxelGI**\ s are used to provide high-quality real-time indirect light and reflections 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. **VoxelGI**\ s need to be baked before having a visible effect. However, once baked, dynamic objects will receive light from them. Furthermore, lights can be fully dynamic or baked.
  15. \ **Note:** **VoxelGI** is only supported in the Forward+ rendering method, not Mobile or Compatibility.
  16. \ **Procedural generation:** **VoxelGI** can be baked in an exported project, which makes it suitable for procedurally generated or user-built levels as long as all the geometry is generated in advance. For games where geometry is generated at any time during gameplay, SDFGI is more suitable (see :ref:`Environment.sdfgi_enabled<class_Environment_property_sdfgi_enabled>`).
  17. \ **Performance:** **VoxelGI** is relatively demanding on the GPU and is not suited to low-end hardware such as integrated graphics (consider :ref:`LightmapGI<class_LightmapGI>` instead). To improve performance, adjust :ref:`ProjectSettings.rendering/global_illumination/voxel_gi/quality<class_ProjectSettings_property_rendering/global_illumination/voxel_gi/quality>` and enable :ref:`ProjectSettings.rendering/global_illumination/gi/use_half_resolution<class_ProjectSettings_property_rendering/global_illumination/gi/use_half_resolution>` in the Project Settings. To provide a fallback for low-end hardware, consider adding an option to disable **VoxelGI** in your project's options menus. A **VoxelGI** node can be disabled by hiding it.
  18. \ **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. To further prevent light leaks, you can also strategically place temporary :ref:`MeshInstance3D<class_MeshInstance3D>` nodes with their :ref:`GeometryInstance3D.gi_mode<class_GeometryInstance3D_property_gi_mode>` set to :ref:`GeometryInstance3D.GI_MODE_STATIC<class_GeometryInstance3D_constant_GI_MODE_STATIC>`. These temporary nodes can then be hidden after baking the **VoxelGI** node.
  19. .. rst-class:: classref-introduction-group
  20. Tutorials
  21. ---------
  22. - :doc:`Using Voxel global illumination <../tutorials/3d/global_illumination/using_voxel_gi>`
  23. - `Third Person Shooter (TPS) Demo <https://godotengine.org/asset-library/asset/2710>`__
  24. .. rst-class:: classref-reftable-group
  25. Properties
  26. ----------
  27. .. table::
  28. :widths: auto
  29. +-------------------------------------------------+--------------------------------------------------------------------+-------------------------+
  30. | :ref:`CameraAttributes<class_CameraAttributes>` | :ref:`camera_attributes<class_VoxelGI_property_camera_attributes>` | |
  31. +-------------------------------------------------+--------------------------------------------------------------------+-------------------------+
  32. | :ref:`VoxelGIData<class_VoxelGIData>` | :ref:`data<class_VoxelGI_property_data>` | |
  33. +-------------------------------------------------+--------------------------------------------------------------------+-------------------------+
  34. | :ref:`Vector3<class_Vector3>` | :ref:`size<class_VoxelGI_property_size>` | ``Vector3(20, 20, 20)`` |
  35. +-------------------------------------------------+--------------------------------------------------------------------+-------------------------+
  36. | :ref:`Subdiv<enum_VoxelGI_Subdiv>` | :ref:`subdiv<class_VoxelGI_property_subdiv>` | ``1`` |
  37. +-------------------------------------------------+--------------------------------------------------------------------+-------------------------+
  38. .. rst-class:: classref-reftable-group
  39. Methods
  40. -------
  41. .. table::
  42. :widths: auto
  43. +--------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | |void| | :ref:`bake<class_VoxelGI_method_bake>`\ (\ from_node\: :ref:`Node<class_Node>` = null, create_visual_debug\: :ref:`bool<class_bool>` = false\ ) |
  45. +--------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | |void| | :ref:`debug_bake<class_VoxelGI_method_debug_bake>`\ (\ ) |
  47. +--------+-------------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Enumerations
  52. ------------
  53. .. _enum_VoxelGI_Subdiv:
  54. .. rst-class:: classref-enumeration
  55. enum **Subdiv**: :ref:`🔗<enum_VoxelGI_Subdiv>`
  56. .. _class_VoxelGI_constant_SUBDIV_64:
  57. .. rst-class:: classref-enumeration-constant
  58. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **SUBDIV_64** = ``0``
  59. 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. .. _class_VoxelGI_constant_SUBDIV_128:
  61. .. rst-class:: classref-enumeration-constant
  62. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **SUBDIV_128** = ``1``
  63. Use 128 subdivisions. This is the default quality setting.
  64. .. _class_VoxelGI_constant_SUBDIV_256:
  65. .. rst-class:: classref-enumeration-constant
  66. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **SUBDIV_256** = ``2``
  67. Use 256 subdivisions.
  68. .. _class_VoxelGI_constant_SUBDIV_512:
  69. .. rst-class:: classref-enumeration-constant
  70. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **SUBDIV_512** = ``3``
  71. Use 512 subdivisions. This is the highest quality setting, but the slowest. On lower-end hardware, this could cause the GPU to stall.
  72. .. _class_VoxelGI_constant_SUBDIV_MAX:
  73. .. rst-class:: classref-enumeration-constant
  74. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **SUBDIV_MAX** = ``4``
  75. Represents the size of the :ref:`Subdiv<enum_VoxelGI_Subdiv>` enum.
  76. .. rst-class:: classref-section-separator
  77. ----
  78. .. rst-class:: classref-descriptions-group
  79. Property Descriptions
  80. ---------------------
  81. .. _class_VoxelGI_property_camera_attributes:
  82. .. rst-class:: classref-property
  83. :ref:`CameraAttributes<class_CameraAttributes>` **camera_attributes** :ref:`🔗<class_VoxelGI_property_camera_attributes>`
  84. .. rst-class:: classref-property-setget
  85. - |void| **set_camera_attributes**\ (\ value\: :ref:`CameraAttributes<class_CameraAttributes>`\ )
  86. - :ref:`CameraAttributes<class_CameraAttributes>` **get_camera_attributes**\ (\ )
  87. The :ref:`CameraAttributes<class_CameraAttributes>` resource that specifies exposure levels to bake at. Auto-exposure and non exposure properties will be ignored. Exposure settings should be used to reduce the dynamic range present when baking. If exposure is too high, the **VoxelGI** will have banding artifacts or may have over-exposure artifacts.
  88. .. rst-class:: classref-item-separator
  89. ----
  90. .. _class_VoxelGI_property_data:
  91. .. rst-class:: classref-property
  92. :ref:`VoxelGIData<class_VoxelGIData>` **data** :ref:`🔗<class_VoxelGI_property_data>`
  93. .. rst-class:: classref-property-setget
  94. - |void| **set_probe_data**\ (\ value\: :ref:`VoxelGIData<class_VoxelGIData>`\ )
  95. - :ref:`VoxelGIData<class_VoxelGIData>` **get_probe_data**\ (\ )
  96. The :ref:`VoxelGIData<class_VoxelGIData>` resource that holds the data for this **VoxelGI**.
  97. .. rst-class:: classref-item-separator
  98. ----
  99. .. _class_VoxelGI_property_size:
  100. .. rst-class:: classref-property
  101. :ref:`Vector3<class_Vector3>` **size** = ``Vector3(20, 20, 20)`` :ref:`🔗<class_VoxelGI_property_size>`
  102. .. rst-class:: classref-property-setget
  103. - |void| **set_size**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  104. - :ref:`Vector3<class_Vector3>` **get_size**\ (\ )
  105. The size of the area covered by the **VoxelGI**. If you make the size larger without increasing the subdivisions with :ref:`subdiv<class_VoxelGI_property_subdiv>`, the size of each cell will increase and result in lower detailed lighting.
  106. \ **Note:** Size is clamped to 1.0 unit or more on each axis.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_VoxelGI_property_subdiv:
  110. .. rst-class:: classref-property
  111. :ref:`Subdiv<enum_VoxelGI_Subdiv>` **subdiv** = ``1`` :ref:`🔗<class_VoxelGI_property_subdiv>`
  112. .. rst-class:: classref-property-setget
  113. - |void| **set_subdiv**\ (\ value\: :ref:`Subdiv<enum_VoxelGI_Subdiv>`\ )
  114. - :ref:`Subdiv<enum_VoxelGI_Subdiv>` **get_subdiv**\ (\ )
  115. Number of times to subdivide the grid that the **VoxelGI** operates on. A higher number results in finer detail and thus higher visual quality, while lower numbers result in better performance.
  116. .. rst-class:: classref-section-separator
  117. ----
  118. .. rst-class:: classref-descriptions-group
  119. Method Descriptions
  120. -------------------
  121. .. _class_VoxelGI_method_bake:
  122. .. rst-class:: classref-method
  123. |void| **bake**\ (\ from_node\: :ref:`Node<class_Node>` = null, create_visual_debug\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_VoxelGI_method_bake>`
  124. Bakes the effect from all :ref:`GeometryInstance3D<class_GeometryInstance3D>`\ s marked with :ref:`GeometryInstance3D.GI_MODE_STATIC<class_GeometryInstance3D_constant_GI_MODE_STATIC>` and :ref:`Light3D<class_Light3D>`\ s marked with either :ref:`Light3D.BAKE_STATIC<class_Light3D_constant_BAKE_STATIC>` or :ref:`Light3D.BAKE_DYNAMIC<class_Light3D_constant_BAKE_DYNAMIC>`. 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 **VoxelGI**'s data and debug any issues that may be occurring.
  125. \ **Note:** :ref:`bake<class_VoxelGI_method_bake>` works from the editor and in exported projects. This makes it suitable for procedurally generated or user-built levels. Baking a **VoxelGI** node generally takes from 5 to 20 seconds in most scenes. Reducing :ref:`subdiv<class_VoxelGI_property_subdiv>` can speed up baking.
  126. \ **Note:** :ref:`GeometryInstance3D<class_GeometryInstance3D>`\ s and :ref:`Light3D<class_Light3D>`\ s must be fully ready before :ref:`bake<class_VoxelGI_method_bake>` is called. If you are procedurally creating those and some meshes or lights are missing from your baked **VoxelGI**, use ``call_deferred("bake")`` instead of calling :ref:`bake<class_VoxelGI_method_bake>` directly.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_VoxelGI_method_debug_bake:
  130. .. rst-class:: classref-method
  131. |void| **debug_bake**\ (\ ) :ref:`🔗<class_VoxelGI_method_debug_bake>`
  132. Calls :ref:`bake<class_VoxelGI_method_bake>` with ``create_visual_debug`` enabled.
  133. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  134. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  135. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  136. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  137. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  138. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  139. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  140. .. |void| replace:: :abbr:`void (No return value.)`