Control Your Lighting in Unity Using Light Layers- Game Dev Series 164

Objective: using light layers to create an efficient light using in game scene.

Since last article we created fog in game scene, the best way to improve the atmosphere is adding some light. I’ve add some light in it but its too much to a simple game scene, especially when your game scene is getting bigger, you would never want these lights would slow down the performance of your game.
With this situation, light layers would be a good way to lower the cost on game performance and also improve the vibe.

Enable light layers

Before we adjust the light with layers, it shows hard light reflecting on objects.

But we would simply need those light spots to emphasize the fog in scene, not cover up the whole place with strong white light.
First thing we need to do is select the HDRP asset to make a basic adjustment.

Under the section of Lighting, drop down Light Layers and click Enable.

Once checked, we can back to our light in scene to make some changes on them.

From nothing to layer

Select the lights and check the Inspector, there should be a cog icon under General drop down menu.

Click it and you should see the option of Light Layers pops out.
First we need to choose the layer to Nothing, that would disable all the reflection in game scene on objects. You should see the result immediately.

Then select any layer you wish in the list, except Everything. In my case, I choose Light Layer 1.

Now you light would no longer affect the objects in scene but provides a good way to enlighten the whole game scene with better vibe.

Compare the result before and after enable light layers in scene.



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