Lighting your scene in Unity using the URP
Lighting is such an important and powerful aspect of a game scene. The lighting can set the mood of the scene and the feel of the environment. This article will cover the different lights you can add to your Unity game.
The GameObject tab will lead you to the Light option, which shows four different kinds of lights that can be added to the game scene.
Directional Light: A directional light is basically the sun, and is typically already in the game scene when creating a new environment. When using the default procedural lightbox, if you find the sun in the sky, it will move as you rotate the directional light widget!
Point Light: These lights are like small round glowing orbs that emit light equally in all directions. I will use some of these point lights to emphasize areas in the game scene of importance for the player to explore.
The Range and Color options on the light are powerful tools. The Mode option represents how the light will act with the dynamic and/ or static objects in the scene. There are options for real-time, baked and mixed. The intensity controls how bright the light is.
There is an interactive widget for adjusting the range in the scene view, or adjustments can also be made in the inspector.
The color adjustment can be previewed in the scene view.
I will be using the mixed option for this demo as the mode.
Spotlight: This handy directional light has some of the same mode and intensity options as the other lights.
Shooting a light in one direction can produce some dramatic shadows.
The spot light has an inner and outer adjustment that can be altered in the scene view or the inspector.
Area Light: This light is specifically for static objects to act as baked lighting. This is great for casting a large and subtle light on environments to brighten up the scene and enhance certain areas.
For this to work, the objects needing the light will need to be checked as Static in the inspector.
My environment assets are in a parent object, so I also need to accept the option to change the children to be static as well.
Now the floor can take lighting info from the area light.
Light culling is basically telling a light source to ignore certain objects. For this scene, I want a directional light aimed downwards, which is like the sun being overhead at high-noon. I can use light culling to ignore the ceiling, which would otherwise block out all of the light. I get started by making a new layer for the ceiling.
All of my ceiling game objects are in a parent empty object, so I can select that and change the layer to the ceiling layer.
Like previously, accept the changes to the children objects to quickly place them all on the ceiling layer.
Now on the directional light under the Culling Mask option, the Ceiling layer can be selected to be ignored.
Now some light from above can enter the room and hit the floor. I can reduce the intensity here, but having some natural room light is a good look.
I make an empty game object named Lighting to act as the parent object for all of the lights in my scene. The different lights are all dragged into this parent object. This will go a long way towards organization.
Let’s begin to illuminate the game scene with some point lights.
This console seems like something I might want the player to interact with, so a nice point light goes here.
The light is pretty reflective. Adjusting down the smoothness in the shader on the wall and floor game objects is a great way to soften the light on the scene.
You can see the results here as I pull back the smoothness on the wall objects.
The console on the opposing wall, as well as the main central terminal get point lights of their own.
A spot light on the zombie in the central test tube is a great way to add some much needed creepiness to the mood here.
The inner and outer angles of the spot light can be adjusted to taste in the scene view.
The orthographic view is a quick way to place my duplicated spot light for the opposing test tube.
Another point light is placed near the roof to bring some attention towards the ceiling behind the monitor struts.
The game scene is starting to have some nice low light mood.
I want some cast shadows from the main consoles to the floor, so I use the directional light aimed directly down, and use a culling mask to ignore the ceiling.
I bring the intensity up just enough to get some soft light and shadows on the floor.
Here is the updated and lit game scene using Unity’s URP. Thanks for reading!