As you work with Unity robust lighting system you will eventually encounter the desire to begin creating reflective surfaces from rain slicked streets to mirrors and pools of water to allow your gorgeous landscapes and intricate characters to be seen in their full glory. Additionally it’s a easy and effective way to increase immersion in your worlds.
There are two ways to illustrate reflections in your game scenes, first is Screen Space Reflections and the second is Reflection Probes.
Using Screen Space Reflections allows you to emulate subtle reflections like a puddle of water or wet surfaces, there are two ways to enable Screen Space Reflections the first being the High Definition Render Pipeline (here) and the Post Processing Stack (here), this is a very expensive but incredibly accurate effect to utilize so it’s best to use sparingly to achieve the desired result.
The second more performant method of reflections are reflection probes. These act as snapshots of their desired area which then produce a texture that you see on reflective objects.
There are three types of reflection for reflection probes, real time, custom and baked. We won’t be talking about Custom but they are similar to baked with a few more options but you can learn about it (here) in the Manual. Real time is as it says on the tin, those are reflections that happen in real time, and given the tight area in which reflection probes work are often better choices for creating reflective elements dynamically.
Baked reflection probes are reflections that are baked along with lighting, these are better used in places where objects don’t move much such as terrain, structures, and other static objects like environmental art that don’t move at all. Either realtime or baked are infinitely more performant than screen space reflections but they come with their own set challenges such as setting them up in your scene correctly, getting reflections to match between multiple probes, and limitations such as tracking dynamic objects correctly.
Understanding which types of reflections and when to use them can be vital. Knowing the difference between taking in the full visual feast of your game while it sips on the player’s system resources or it grinding to halt as it stutters, lags, and otherwise runs the player’s experience in your game. Until next time, happy coding.