Lighting is a crucial part of game development. In this tutorial, we will look at several ways to change the lighting of your game in Unity. If you are a beginner and want to learn how to build virtual reality games, check out our Unity 3D course!
The lighting in your game can set the tone of the scene and provide useful information for your players. Unity’s default light is Directional Light. Rays extend from Directional Light in all directions. When a ray hits an object, a shadow will project on the floor.
One way to change a game’s lighting is to change the Scene’s Ambient Intensity. Select Directional Light. Deselect its Light component in the Inspector. Go to Window > Lighting.
The Lighting window will appear. Select the Scene tab. Here you can change the value of the “Ambient Intensity” slider. The appearance of the Scene will change depending on the value.
Set Ambient Intensity to 1. Close the Lighting window. Change the position of Directional Light in any axis. Notice that the intensity of the Scene’s light and the shadows do not change. This is because Directional Light is so far away that no matter where it is located, the projection will be the same.
However, changing Directional Light’s rotation does change the Scene’s lighting. Select the Rotation tool in the top left. In the Scene, move the circles around Directional Light. The appearance of the shadows in the Scene will change.
Rotating the Directional Light is like moving the sun. Pointing the light completely above the floor makes the Scene dark, as though it were nighttime. Set the Rotation values to 50 -30 0 for now.
There are other kinds of lights. In the Light component in the Inspector, change the Type to Spot. Spot is a spotlight that is rendered to point at a certain area. You can change the range of the spotlight (how far it points), its angle (how wide its is), and its intensity.
The spotlight can feature an element in the Scene. For instance, we can point the spotlight at Cube to give attention to it. You can also change the color of the spotlight, such as to blue to give a sense of mystery, or to red for danger.
Another type of light is Point, shown in the next image. The Point light is a light bulb. It is a point that projects light in every direction.
Zoom out in the Scene. You will see a yellow dome, which represents the range of the Point light. You can decrease the Point light’s range to make the dome smaller.
There are many other properties that you can alter to change your game’s lighting, so stay curious, and experiment in the Inspector. To learn more about Unity, check out our Unity 3D course, where you build 30 virtual reality games!