Lighting and the 3D Environment

One of the mechanics that are usually simplified in 2D games is lightning and its effect on the environment. This is because of the “simplistic” view of 2D games while being complex in 3D games.

2D lighting

2D Lighting in Unity; Source: Unity

One of the reasons why lighting is “simplistic” in 2D environment is the position of the camera. Due to the fact the camera is generally fixed to one position, and therefore the light source is stationary, any shadows cast by the light that is not directly in front of the camera will likely not be noticed by the player.

Sparklite, Source: Red Blue Games

In this example from the game Sparklite, because the camera is fixed in a downward angle at the player, shadows appear below the objects in the scene. From the crates and rocks to the player, their corresponding shadows shows right below them. However, if the light source is or from the camera, there should be a long shadow behind the objects in the scene, which we do not observe.

Dungeon League, Source: Christopher Yabsley

On the other hand, if the camera isn’t the perceived light source the light source is still stationary. Take Dungeon League as an example; even though the game is virtually dark, the light source is stationary. In Unity, this can be achieved by attaching a light source to an object, whether it be an item or the player themselves. This result in a darker environment with the only objects being lit up are the important objects or those within view of the light source.

3D Lighting

Shadows cast with light source attached to Camera

One might think that 3D environment is similar to its 2D counterpart in terms of lighting effects and they won’t be wrong. However, unlike its 2D counterpart, because the camera can rotate at any time, it’s necessary to ensure the shadows cast are realistic.

Camera in one Position
Camera in a different position

Another difference between 2D lighting and 3D lighting is the reflection effects. In a 2D environment, reflections are usually not implemented due to the fixed position of the camera. However, in a 3D environment, it becomes an upmost importance for that realistic look. Although it’s hard to see, the glossy nature of the marble floor would create a reflection, which it does.

Last, but not least, the usage of light probes makes it easier to render lights in a 3D environment. Light probes allows objects to capture and use light information as it moves around the scene. It achieves this by storing information about lighting hitting empty spaces and whenever an object comes into contact with said empty space, the probe can relay lighting information to the object to generate a more realistic lighting effects on the object.