2
0

reflection_probes.rst 9.5 KB

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