reflection_probes.rst 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. .. _doc_reflection_probes:
  2. Reflection probes
  3. =================
  4. Introduction
  5. ------------
  6. As stated in the :ref:`doc_spatial_material`, objects can show reflected or diffuse light.
  7. Reflection probes are used as a source of reflected and ambient light for objects inside their area of influence.
  8. A probe of this type captures the surroundings (as a sort of 360 degrees image), and stores versions
  9. of it with increasing levels of *blur*. This is used to simulate roughness in materials, as well as ambient lighting.
  10. While these probes are an efficient way of storing reflections, they have a few shortcomings:
  11. * They are efficient to render, but expensive to compute. This leads to a default behavior where they only capture on scene load.
  12. * They work best for rectangular shaped rooms or places, otherwise the reflections shown are not as faithful (especially when roughness is 0).
  13. Setting up
  14. ----------
  15. Create a ReflectionProbe node and wrap it around the area where you want to have reflections:
  16. .. image:: img/refprobe_setup.png
  17. This should result in immediate local reflections. If you are using a Sky texture,
  18. reflections are by default blended with it.
  19. By default, on interiors, reflections may appear not to have much consistence.
  20. In this scenario, make sure to tick the *"Box Correct"* property.
  21. .. image:: img/refprobe_box_property.png
  22. This setting changes the reflection from an infinite skybox to reflecting
  23. a box the size of the probe:
  24. .. image:: img/refprobe_boxcorrect.png
  25. Adjusting the box walls may help improve the reflection a bit, but it will
  26. always look best in box shaped rooms.
  27. The probe captures the surrounding from the center of the gizmo. If, for some
  28. reason, the room shape or contents occlude the center, it
  29. can be displaced to an empty place by moving the handles in the center:
  30. .. image:: img/refprobe_center_gizmo.png
  31. By default, shadow mapping is disabled when rendering probes (only in the
  32. rendered image inside the probe, not the actual scene). This is
  33. a simple way to save on performance and memory. If you want shadows in the probe,
  34. they can be toggled on/off with the *Enable Shadow* setting:
  35. .. image:: img/refprobe_shadows.png
  36. Finally, keep in mind that you may not want the Reflection Probe to render some
  37. objects. A typical scenario is an enemy inside the room which will
  38. move around. To keep objects from being rendered in the reflections,
  39. use the *Cull Mask* setting:
  40. .. image:: img/refprobe_cullmask.png
  41. Interior vs exterior
  42. --------------------
  43. If you are using reflection probes in an interior setting, it is recommended
  44. that the **Interior** property be enabled. This stops
  45. the probe from rendering the sky and also allows custom ambient lighting settings.
  46. .. image:: img/refprobe_ambient.png
  47. When probes are set to **Interior**, custom constant ambient lighting can be
  48. specified per probe. Just choose a color and an energy.
  49. Optionally, you can blend this ambient light with the probe diffuse capture by
  50. tweaking the **Ambient Contribution** property (0.0 means pure ambient color,
  51. while 1.0 means pure diffuse capture).
  52. Blending
  53. --------
  54. Multiple reflection probes can be used, and Godot will blend them where they overlap using a smart algorithm:
  55. .. image:: img/refprobe_blending.png
  56. As you can see, this blending is never perfect (after all, these are
  57. box reflections, not real reflections), but these artifacts
  58. are only visible when using perfectly mirrored reflections.
  59. Normally, scenes have normal mapping and varying levels of roughness, which
  60. can hide this.
  61. Alternatively, Reflection Probes work well blended together with Screen Space
  62. Reflections to solve these problems. Combining them makes local reflections appear
  63. more faithful, while probes are only used as a fallback when no screen-space information is found:
  64. .. image:: img/refprobe_ssr.png
  65. Finally, blending interior and exterior probes is the recommended approach when making
  66. levels that combine both interiors and exteriors. Near the door, a probe can
  67. be marked as *exterior* (so it will get sky reflections) while on the inside, it can be interior.
  68. Reflection atlas
  69. ----------------
  70. In the current renderer implementation, all probes are the same size and
  71. are fit into a Reflection Atlas. The size and amount of probes can be
  72. customized in Project Settings -> Quality -> Reflections
  73. The default setting of Atlas Subdiv: 8 will allow up to 16 reflection probes in a scene. This value needs to be increased if you need more reflection probes.
  74. .. image:: img/refprobe_atlas.png