reflection_probes.rst 9.1 KB

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