reflection_probes.rst 4.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 a 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, reflections are by default blended with it.
  18. By default, on interiors, reflections may appear to not have much consistence. In this scenario, make sure to tick the *"Box Correct"* property.
  19. .. image:: img/refprobe_box_property.png
  20. This setting changes the reflection from an infinite skybox to reflecting a box the size of the probe:
  21. .. image:: img/refprobe_boxcorrect.png
  22. Adjusting the box walls may help improve the reflection a bit, but it will always look the best in box shaped rooms.
  23. The probe captures the surrounding from the center of the gizmo. If, for some reason, the room shape or contents occlude the center, it
  24. can be displaced to an empty place by moving the handles in the center:
  25. .. image:: img/refprobe_center_gizmo.png
  26. By default, shadow mapping is disabled when rendering probes (only in the rendered image inside the probe, not the actual scene). This is
  27. a simple way to save on performance and memory. If you want shadows in the probe, they can be toggled on/off with the *Enable Shadow* setting:
  28. .. image:: img/refprobe_shadows.png
  29. Finally, keep in mind that you may not want the Reflection Probe to render some objects. A typical scenario is an enemy inside the room which will
  30. move around. To keep objects from being rendered in the reflections, use the *Cull Mask* setting:
  31. .. image:: img/refprobe_cullmask.png
  32. Interior vs Exterior
  33. --------------------
  34. If you are using reflection probes in an interior setting, it is recommended that the **Interior** property is enabled. This makes
  35. the probe not render the sky, and also allows custom ambient lighting settings.
  36. .. image:: img/refprobe_ambient.png
  37. When probes are set to **Interior**, custom constant ambient lighting can be specified per probe. Just choose a color and an energy.
  38. Optionally, you can blend this ambient light with the probe diffuse capture by tweaking the **Ambient Contribution** property (0.0 means, pure ambient color, while 1.0 means pure diffuse capture).
  39. Blending
  40. --------
  41. Multiple reflection probes can be used and Godot will blend them where they overlap using a smart algorithm:
  42. .. image:: img/refprobe_blending.png
  43. As you can see, this blending is never perfect (after all, these are box reflections, not real reflections), but these artifacts
  44. are only visible when using perfectly mirrored reflections. Normally, scenes have normal mapping and varying levels of roughness which
  45. can hide this.
  46. Alternatively, Reflection Probes work well blended together with Screen Space Reflections to solve these problems. Combining them makes local reflections appear
  47. more faithful, while probes only used as fallback when no screen-space information is found:
  48. .. image:: img/refprobe_ssr.png
  49. Finally, blending interior and exterior probes is a recommended approach when making levels that combine both interiors and exteriors. Near the door, a probe can
  50. be marked as *exterior* (so it will get sky reflections), while on the inside it can be interior.
  51. Reflection Atlas
  52. ----------------
  53. In the current renderer implementation, all probes are the same size and they are fit into a Reflection Atlas. The size and amount of probes can be
  54. customized in Project Settings -> Quality -> Reflections
  55. .. image:: img/refprobe_atlas.png