A Guild to Beautiful Games
Adding in Lights
There are several types of lighting fixtures within Unity and they each provide an unique aspect to lighting up your scene. In this article we will explain what each of them are and how they can be applied to your scene, and when to use them accordingly.
The Directional light is the first light source that is setup by default when you first launch Unity. This light source illuminates the entire scene like a sun and is infinite in terms of size and direction. It will also illuminate everything, be it inside an enclosed space or outside. The light hits in a parallel direction only which can be adjusted within the Y Rotation.
The Directional Light is usually used when there is an open scene set to an outdoors theme. Since the directional light hit every single object, it will cast shadows on everything. So if you have an enclosed structure (aka inside a house) the directional Light will not be best fit since everything will be lit.
As the name suggest, the spot light is a light source that focuses strongly on one single point, kind of like a spot lamp. The spot light only illuminates the targeted area while leaving the rest of the objects in the dark. The spot light can be adjusted with rotation and also the width of the illuminated area.
The Spot Light is great for any enclosed area, it is usually used to direct players to a certain important area or object within a scene, be an interactive construct or a location of importance.
The Area Light only works within Baked (static) objects and provides a similar result as Direction Light, but albeit more controlled. With the Area Light, you are able to light up objects and the ground within a set restriction. Anything outside of this area will not be lit.
The Area Light is useful when trying to implement ambient lighting at a very dim intensity. If I want to light up a mystic pond but nothing else, then I would use the Area light to surround the pond.
Finally the final light source is the “point light”. As the name suggest a point light is basically a singular source of light that radiates outward, think of it as a light bulb. The range of the omnidirectional light source can be adjusted to whatever the size is needed, and since it is omnidirectional there is no need to adjust rotation.
The Point Light is useful for areas that allow light to bounce off objects and cast shadows. Usually applied as actual electrical light source like lamps and other indoor lighting fixtures.
When applying more than one light source to your scene, you will realized that you might want some light to illuminate certain objects and leave out unimportant objects. An very good example is having the roof of an enclosed scene omitted from receiving a light source since most of the time, the players won’t care but illuminated objects stuck on the roof. (of course unless your game requires them)
This is where Light Culling comes in, if we separate the roof into a different layer, we are able to have our light source (in this case our Directional Light) ignore the roof elements and direction illuminate the floor directly.
To use Light Culling within the HDRP pipeline, we first must enable this feature within the HDRP settings. In the projects view, click on the Default HDRP Asset, then in the Inspector you will see several tabs available. Select the Lighting tab and check on the Light Layers.
The select any available light source in the hierarchy, within the General tabs in the Inspector there should be an icon of a gear with a plus icon, click it to show more options. This will bring in the Light Layers drop down menu which you can manually select which light layer you want to cull.
Lighting plays a very important part of setting the mood of the game and also plays an important part in directional wayfinding for the players. Just like a air traffic light map on the road can direct where the airplane can land, the light sources can also affect where the players are moving towards.