reflection_probes.rst 8.2 KB

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