4 min read

In this article by Satheesh PV, author of the book Unreal Engine 4 Game Development Essentials, we will learn that lighting is an important factor in your game, which can be easily overlooked, and wrong usage can severely impact on performance. But with proper settings, combined with post process, you can create very beautiful and realistic scenes.

We will see how to place lights and how to adjust some important values.

(For more resources related to this topic, see here.)

Placing lights

In Unreal Engine 4, lights can be placed in two different ways. Through the modes tab or by right-clicking in the level:

  • Modes tab: In the Modes tab, go to place tab (Shift + 1) and go to the Lights section. From there you can drag and drop various lights.

    Unreal Engine 4 Game Development Essentials

  • Right-clicking: Right-click in viewport and in Place Actor you can select your light.

    Unreal Engine 4 Game Development Essentials

Once a light is added to the level, you can use transform tool (W to move, E to rotate) to change the position and rotation of your selected light.

Since Directional Light casts light from an infinite source, updating their location has no effect.

Various lights

Unreal Engine 4 features four different types of light Actors. They are:

  • Directional Light: Simulates light from a source that is infinitely far away. Since all shadows casted by this light will be parallel, this is the ideal choice for simulating sunlight.
  • Spot Light: Emits light from a single point in a cone shape. There are two cones (inner cone and outer cone). Within inner cone, light achieves full brightness and between inner and outer cone a falloff takes place, which softens the illumination. That means after inner cone, light slowly loses its illumination as it goes to outer cone.
  • Point Light: Emits light from a single point to all directions, much like a real-world light bulb.
  • Sky Light: Does not really emit light, but instead captures the distant parts of your scene (for example, Actors that are placed beyond Sky Distance Threshold) and applies them as light. That means you can have lights coming from your atmosphere, distant mountains, and so on. Note that Sky Light will only update when you rebuild your lighting or by pressing Recapture Scene (in the Details panel with Sky Light selected).

Common light settings

Now that we know how to place lights into a scene, let’s take a look at some of the common settings of a light. Select your light in a scene and in the Details panel you will see these settings:

  • Intensity: Determines the intensity (energy) of the light. This is in lumens units so, for example, 1700 lm (lumen units) corresponds to a 100 W bulb.
  • Light Color: Determines the color of light.
  • Attenuation Radius: Sets the limit of light. It also calculates the falloff of light. This setting is only available in Point Lights and Spot Lights.

    Unreal Engine 4 Game Development Essentials

    Attenuation Radius from left to right: 100, 200, 500.

  • Source Radius: Defines the size of specular highlights on surfaces. This effect can be subdued by adjusting the Min Roughness setting. This also affects building light using Lightmass. Larger Source Radius will cast softer shadows. Since this is processed by Lightmass, it will only work on Lights with mobility set to Static

    Unreal Engine 4 Game Development Essentials

    Source Radius 0. Notice the sharp edges of the shadow.

    Unreal Engine 4 Game Development Essentials

    Source Radius 0. Notice the sharp edges of the shadow.

  • Source Length: Same as Source Radius.

Light mobility

Light mobility is an important setting to keep in mind when placing lights in your level because this changes the way light works and impacts on performance. There are three settings that you can choose. They are as follows:

  • Static: A completely static light that has no impact on performance. This type of light will not cast shadows or specular on dynamic objects (for example, characters, movable objects, and so on). Example usage: Use this light where the player will never reach, such as distant cityscapes, ceilings, and so on. You can literally have millions of lights with static mobility.
  • Stationary: This is a mix of static and dynamic light and can change its color and brightness while running the game, but cannot move or rotate. Stationary lights can interact with dynamic objects and is used where the player can go.
  • Movable: This is a completely dynamic light and all properties can be changed at runtime. Movable lights are heavier on performance so use them sparingly.

Only four or fewer stationary lights are allowed to overlap each other. If you have more than four stationary lights overlapping each other the light icon will change to red X, which indicates that the light is using dynamic shadows at a severe performance cost!

Unreal Engine 4 Game Development Essentials

In the following screenshot, you can easily see the overlapping light.

Unreal Engine 4 Game Development Essentials

Under View Mode, you can change to Stationary Light Overlap to see which light is causing an issue.

Summary

We will look into different light mobilities and learn more about Lightmass Global Illumination, which is the static Global Illumination solver created by Epic games. We will also learn how to prepare assets to be used with it.

Resources for Article:

 


Further resources on this subject:


LEAVE A REPLY

Please enter your comment!
Please enter your name here