Reflection Probes in Unity
Highly realistic reflections are a prominent feature in CG movies and animation, and they are crucial for really bringing a scene together and adding a professional polish feel to them. Although this is not a problem for films, the precision of these reflections is very expensive and taxing in processor time, which drastically restricts the use of reflective objects in real-time environments like the ones found in Video Games.
How do we as developers and designers respond to this resource fatigue? Well, one of the ways we can counteract this is by using Reflection Probes. Although they are not perfect, the polish they can add to your scene at a low cost in processor time might well be worth your while.
Objective: Learn a brief overview of what reflection probes are, how they work, and how to add them.
Table of Contents:
· What are Reflection Probes
· How do they work?
· Different Types of Reflection Probes
· How to Add Reflection Probes
What are Reflection Probes
Reflection Probes are an improvement to Reflection Mapping. By sampling the visual surroundings of a scene, a reflection probe is able to project the visuals as reflections onto the adjacent surfaces.
→Think of it as a reflective sphere that snapshots its surrounding surfaces, then pastes them as reflections onto objects in its proximity.
Here you can see how the light is reflected onto surfaces whenever the Reflective Probe is in proximity.
When a reflective object is near a probe, the probe’s reflection can be used to create the object’s reflection map. In addition, when multiple probes are close together, Unity can interpolate between them to allow for progressive changes in reflections. As a result, using reflection probes can produce pretty believable reflections with less taxing processes.
How do they work?
Reflection Probes use cubemaps to their advantage because the visual information of any area in a scene can be represented by a cubemap.
A Cubemap is essentially a six-sided box with flat images/snapshots of the surrounding environment on each of its six sides(directions).
Reflection Probes enable you to place cubemap snapshots at a variety of predetermined spots in the scene. As a result, you may capture the surrounding view at any place in the scene where reflections differ considerably. These captured images are then projected accordingly.
Different Types of Reflection Probes
There are three different types of Reflection Probes
- Baked: Made through a reflection cubemap prebuilt/baked within the editor.
- Realtime: Instead of using the editor, probes generate the cubemap at runtime in the player. This implies that the reflections are not confined to static objects and may be adjusted in real-time to reflect changes in the scene.
- Custom: Like the Baked probes, a custom probe allows you to bake the view in the editor with the additional option to add a custom-made cubemap for the reflections.
How to Add Reflection Probes
- Create an empty game object and add a Reflection Probe component to it.
Another way to add it is by accessing the Component menu → Rendering →Reflection Probe
2. The way a Reflection Probe knows which areas to affect is by using its bounding box. You will need to make sure that the size is adequate, in my case, this need to cover the entire inner structure of my level. When using a probe that mirrors the interior of a room, be sure the size matches the dimensions of the space.
3. Adjust the intensity of the reflectivity
5. You may tweak the Box Projection option as well.
This option enables you to build a reflection cubemap at a specific distance from the probe, allowing objects to show different-sized reflections based on their distance from the cubemap’s walls. The changes caused by these options will be determined by the size of the bounding box.
The Result:
In the gif image, you can see how the lights reflect on the floor:
Be sure to visit the official Unity Manual for further documentation.
Thank you for your time! If you found some valuable information, give me a follow! I document my learning journey as a Unity Developer and Software Engineer.