Day 51 — Looking into light probes in Unity

Hey and welcome!

Let’s have a little talk and play about with light probes in this one.

A light probe group is very handy for getting some great optimization in the game as one group can handle all the dynamic lighting in your game/scene. This means that you don’t need several different lighting objects to handle this effect which is particularly handy for mobile games.

You can see the current light probe group in the game by navigating to LightProbes_RefProbes_GodRays > Light Probe Group.

I don’t know about you but that’s a lot to take in currently and this is something that would have taken a bit of time to build, let’s go ahead and delete this and create our own light probe group to play about with.

To do this you’ll need to right-click in the hierarchy and select the Light > Light Probe Group option. With that done you’ll get a small group in the scene with a few yellow points on it. In the inspector for the group click on the Edit Light Probes option to move the yellow balls about and duplicate them. Drag the group over surveillance desk and cube and edit the group so that it’s covering both similar to this:

These two objects here, the security desk and the cube or giving off their own lighting through the use of emission using a material. If you look into the material for the cube first and have a look at the emission you’ll notice that it’s using a plain white texture for the colour in order to emit white lighting. If you were to change the colour of this to green it will give off a green light from the cube and other objects using this material.

This is just a single colour though covering the whole cube, if you take a look at the emission for the security desk you’ll notice that there’s more going on in the texture as it’s specifying which parts of the object to emit light from which is any bit that isn’t black. This is pretty useful as we don’t need to rely on the global directional light to light up this object and our display case in the scene.

With our probes set up though they are storing the light data being emitted from these objects in order to provide dynamic lighting for any object passing on through like this:

In the first light probe group we deleted you can see just how much can be done with this and equally appreciate how long it can take to set it up.