reflection_probes.rst 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. .. _doc_reflection_probes:
  2. Reflection probes
  3. =================
  4. .. note::
  5. Reflection probes are only supported in the Forward+ and Mobile renderers,
  6. not the Compatibility renderer.
  7. As stated in the :ref:`doc_standard_material_3d`, objects can show reflected and/or
  8. diffuse light. Reflection probes are used as a source of reflected *and* ambient
  9. light for objects inside their area of influence. They can be used to provide
  10. more accurate reflections than :ref:`VoxelGI <doc_using_voxel_gi>` and
  11. :ref:`SDFGI <doc_using_sdfgi>` while being fairly cheap on system resources.
  12. Since reflection probes can also store ambient light, they can be used as a
  13. low-end alternative to VoxelGI and SDFGI when :ref:`baked lightmaps
  14. <doc_using_lightmap_gi>` aren't viable (e.g. in procedurally generated levels).
  15. Reflection probes can also be used at the same time as screen-space reflections
  16. to provide reflections for off-screen objects. In this case, Godot will blend
  17. together the screen-space reflections and reflections from reflection probes.
  18. .. seealso::
  19. Not sure if ReflectionProbe is suited to your needs?
  20. See :ref:`doc_introduction_to_global_illumination_comparison`
  21. for a comparison of GI techniques available in Godot 4.
  22. Visual comparison
  23. -----------------
  24. .. figure:: img/gi_none.webp
  25. :align: center
  26. :alt: Reflection probe disabled. Environment sky is used as a fallback.
  27. Reflection probe disabled. Environment sky is used as a fallback.
  28. .. figure:: img/gi_none_reflection_probe.webp
  29. :align: center
  30. :alt: Reflection probe enabled.
  31. Reflection probe enabled.
  32. .. figure:: img/gi_lightmap_gi_indirect_only_reflection_probe.webp
  33. :align: center
  34. :alt: Reflection probe enabled.
  35. Reflection probe enabled with LightmapGI used at the same time. The lightmap appears in the reflection.
  36. By combining reflection probes with screen-space reflections, you can get the
  37. best of both worlds: high-quality reflections for general room structure (that
  38. remain present when off-screen), while also having real-time reflections for
  39. small details.
  40. .. figure:: img/reflection_probes_reflection_probe.webp
  41. :align: center
  42. :alt: Reflections in a room using ReflectionProbe only.
  43. Reflections in a room using ReflectionProbe only. Notice how small details
  44. don't have any reflections.
  45. .. figure:: img/reflection_probes_ssr.webp
  46. :align: center
  47. :alt: Reflections in a room using screen-space reflections only.
  48. Reflections in a room using screen-space reflections only. Notice how the
  49. reflection on the sides of the room's walls is partly missing due to being
  50. off-screen.
  51. .. figure:: img/reflection_probes_reflection_probe_ssr.webp
  52. :align: center
  53. :alt: Reflections in a room using ReflectionProbe and screen-space reflections together.
  54. Reflections in a room using ReflectionProbe and screen-space reflections together.
  55. The screen-space reflections are blended with the reflection probe,
  56. acting as a fallback in situations where the reflection probe fails to display
  57. any reflection.
  58. Setting up a ReflectionProbe
  59. ----------------------------
  60. - Add a :ref:`class_ReflectionProbe` node.
  61. - Configure the ReflectionProbe's extents in the inspector to fit your scene. To
  62. get reasonably accurate reflections, you should generally have one
  63. ReflectionProbe node per room (sometimes more for large rooms).
  64. .. tip::
  65. Remember that ReflectionProbe extents don't have to be square, and you can
  66. even rotate the ReflectionProbe node to fit rooms that aren't aligned with
  67. the X/Z grid. Use this to your advantage to better cover rooms without
  68. having to place too many ReflectionProbe nodes.
  69. ReflectionProbe properties
  70. --------------------------
  71. - **Update Mode:** Controls when the reflection probe updates.
  72. **Once** only renders the scene once every time the ReflectionProbe is moved.
  73. This makes it much faster to render compared to the **Always** update mode,
  74. which forces the probe to re-render everything around it every frame.
  75. Leave this property on **Once** (default) unless you need the reflection probe
  76. to update every frame.
  77. - **Intensity:** The brightness of the reflections and ambient lighting. This
  78. usually doesn't need to be changed from its default value of ``1.0``, but you
  79. can decrease it ``1.0`` if you find that reflections look too strong.
  80. - **Max Distance:** Controls the maximum distance used by the ReflectionProbe's
  81. internal camera. The distance is always at least equal to the **Extents**, but
  82. this can be increased to make objects located outside the extents visible in
  83. reflections. *This property does not affect the maximum distance at which the
  84. ReflectionProbe itself is visible.*
  85. - **Extents:** The area that will be affected by the ReflectionProbe's lighting
  86. and reflections.
  87. - **Origin Offset:** The origin to use for the internal camera used for
  88. reflection probe rendering. This must always be constrained within the
  89. **Extents**. If needed, adjust this to prevent the reflection from being
  90. obstructed by a solid object located exactly at the center of the
  91. ReflectionProbe.
  92. - **Box Projection:** Controls whether parallax correction should be used when
  93. rendering the reflection probe. This adjusts the reflection's appearance
  94. depending on the camera's position (relative to the reflection probe). This
  95. has a small performance cost, but the quality increase is often worth it in
  96. box-shaped rooms. Note that this effect doesn't work quite as well in rooms
  97. with less regular shapes (such as ellipse-shaped rooms).
  98. - **Interior:** If enabled, ambient lighting will not be sourced from the
  99. environment sky, and the background sky won't be rendered onto the reflection
  100. probe.
  101. - **Enable Shadows:** Controls whether real-time light shadows should be
  102. rendered within the reflection probe. Enable this to improve reflection
  103. quality at the cost of performance. This should be left disabled for
  104. reflection probes with the **Always** mode, as it's very expensive to render
  105. reflections with shadows every frame. Fully :ref:`baked light <doc_using_lightmap_gi>`
  106. shadows are not affected by this setting and will be rendered in the
  107. reflection probe regardless.
  108. - **Cull Mask:** Controls which objects are visible in the reflection. This can
  109. be used to improve performance by excluding small objects from the reflection.
  110. This can also be used to prevent an object from having self-reflection
  111. artifacts in situations where **Origin Offset** can't be used.
  112. - **Mesh LOD Threshold:** The automatic level of detail threshold to use for
  113. rendering meshes within the reflection. This only affects meshes that have
  114. automatic LODs generated for them. Higher values can improve performance by
  115. using less detailed geometry, especially for objects that are far away from
  116. the reflection's origin. The visual difference of using less detailed objects
  117. is usually not very noticeable during gameplay, especially in rough
  118. reflections.
  119. The Ambient category features several properties to adjust ambient lighting
  120. rendered by the ReflectionProbe:
  121. - **Mode:** If set to **Disabled**, no ambient light is added by the probe. If
  122. set to **Environment**, the ambient light color is automatically sampled from
  123. the environment sky (if **Interior** is disabled) and the reflection's average
  124. color. If set to **Constant Color**, the color specified in the **Color**
  125. property is used instead. The **Constant Color** mode can be used as an
  126. approximation of area lighting.
  127. - **Color:** The color to use when the ambient light mode is set to **Constant Mode**.
  128. - **Color Energy:** The multiplier to use for the ambient light custom
  129. **Color**. This only has an effect when the ambient light mode is **Custom
  130. Color**.
  131. ReflectionProbe blending
  132. ------------------------
  133. To make transitions between reflection sources smoother, Godot supports automatic
  134. probe blending:
  135. - Up to 4 ReflectionProbes can be blended together at a given location.
  136. A ReflectionProbe will also fade out smoothly back to environment lighting
  137. when it isn't touching any other ReflectionProbe node.
  138. - SDFGI and VoxelGI will blend in smoothly with ReflectionProbes if used.
  139. This allows placing ReflectionProbes strategically to get more accurate (or fully real-time)
  140. reflections where needed, while still having rough reflections available in the
  141. VoxelGI or SDFGI's area of influence.
  142. To make several ReflectionProbes blend with each other, you need to have part of
  143. each ReflectionProbe overlap each other's area. The extents should only overlap
  144. as little possible with other reflection probes to improve rendering performance
  145. (typically a few units in 3D space).
  146. Limitations
  147. -----------
  148. When using the Forward+ renderer, Godot uses a *clustering* approach for
  149. reflection probe rendering. As many reflection probes as desired can be added (as long as
  150. performance allows). However, there's still a default limit of 512 *clustered
  151. elements* that can be present in the current camera view. A clustered element is
  152. an omni light, a spot light, a :ref:`decal <doc_using_decals>` or a
  153. :ref:`reflection probe <doc_reflection_probes>`. This limit can be increased by adjusting
  154. :ref:`Max Clustered Elements<class_ProjectSettings_property_rendering/limits/cluster_builder/max_clustered_elements>`
  155. in **Project Settings > Rendering > Limits > Cluster Builder**.
  156. When using the Mobile renderer, only 8 reflection probes can be applied on each
  157. individual Mesh *resource*. If there are more reflection probes affecting a single mesh,
  158. not all of them will be rendered on the mesh.
  159. Similarly, when using the Compatibility renderer, up to 2 reflection probes can
  160. be applied per mesh. If more than 2 reflection probes affect a single mesh,
  161. additional probes will not be rendered.