Nerd For Tech
Published in

Nerd For Tech

Unity Guide

Using light probes in Unity

A quick guide about using light probes in Unity

Objective: Use light probes in a scene to cast baked light onto dynamic objects.

In the last post I covered some environmental and lighting aspects of Unity in 3D. Now, it’s time to create and use light probes to cast baked light in dynamic objects with Unity.

Creating light probes

In our current scene we have a cube that, instead of using a directional light, contains a customized material that emits white light through the emission channel. As you can see in the next gif, the light doesn’t affect the sphere in front of it when it moves:

So, in order to display a lighting effect in the sphere while it moves, we can make use of light probes. Let’s create one group by clicking in + > Light > Light Probe Group:

If you want to know more about light probe groups you can visit the Unity docs:

Once the light probe group is created we’ll be able to see in the scene how the baked light of the cube starts making effect on the space at the front (including the sphere):

Implementing the light probes

Now, in order to modify the position of the 8 light probes in our group, we’ll need to click the Edit Light Probes button in the inspector. Also, there are another 4 buttons that allow us to add, select, delete or duplicate the light probes in our group:

So, in order to handle the baked light with a realistic approach, let’s edit the light probes to cover a simple area near the cube. The light probes interpolate the level of light between each one of them. If one light probe is near a baked light and the next one is not near a baked light, the level of light that passes between them will decrease when we approach the 2nd light probe.

You can see how it works in the next gif. As soon as I move new light probes to a position where there’s no baked light, the light level decreases:

The light probes will store information about the baked light in the scene so that we can have a way to display that light passing through empty spaces in the scene:

And now, thanks to the light probe group, when we move the sphere we’ll be able to notice that the level of light that is reflected changes when it enters in another group of light probes connected (yellow lines):

This way, we can use light probes to interpolate baked lights in bigger scenarios. Using them will improve the performance of a game.

And that’s it, we used light probes to handle interactions with baked lights in Unity! :D. I’ll see you in the next post, where I’ll be showing the difference between reflection probes and screen space reflections in Unity.

If you want to know more about me, feel free to connect with me on LinkedIn or visit my website :D

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Fernando Alcantara Santana

Fernando Alcantara Santana

A passionate computer technology engineer and Unity developer that is always looking to grow in every aspect of life :).