Dynamic Lighting Gameplay with UE4 and Enlighten using Blueprints

December 3rd, 2014

*Some video and link content may no longer be available. Please see the bottom of the page for details.

“This is gorgeous! I remember having dreams about this kind of dynamic indirect lighting back when I was building the Unreal Engine 1 renderer!”
-Tim Sweeney, Founder of Epic Games

Enlighten and UE4 enable new ways of interacting with lights which were previously impossible without breaking the believability provided by the indirect lighting. The focus of this post is dynamic lighting and gameplay. I hope to cover other aspects of the video such as the set-up process in a later post.

Real-time Light Editing – UE4 + Enlighten

With UE4 and Enlighten we can place or modify lighting when editing or during gameplay, and Enlighten will bounce the lighting and provide reflection cubemaps in real time.

Enlighten works alongside all of Unreal’s built in graphics features such as ambient occlusion and screen space reflections, both of which are used in the video.

This workflow video shows two spotlights and the Enlighten Skylight being used to fully light the room very quickly.

Materials and Transmission

We start the video by showing the sunlit room, with strong sunlight hitting the curtains. As the sun goes down, the directional light hits the curtain from behind and we transmit the direct lighting through the curtain into the global illumination. Because the curtains are red, this gives a warm tonality to the room.

We can see the effect more clearly with a spotlight in the screenshots and video below:

Blueprint: Television

The dynamic light sources create a mysterious atmosphere in contrast to the sunlight at the start. We use Blueprints to enable interaction with the lighting.

The shader running on the television animates the noise and flashes the screen on. It has an intensity value exposed via the material parameters. Enlighten allows us to assign an emissive material to a static mesh such as the television screen, effectively turning it into a stationary area light.

We animate the colour of the rendered material, as well as the Enlighten emissive property, by multiplying a colour with three float curves defined in the timelines; one to fade in/out and two phase-offset noisy curves multiplied with each other. This gives a soft random motion to the flicker. We set the light and material parameters every frame and call events on the Timeline when we want to turn the television on and off.

Given more time we could have added:

  • A movie on the television screen. In the Blueprint, we’re keeping consistency between shader and lighting parameters through an exposed parameter in the shader.
  • Audible white noise, and triggering the television shortly after the player enters the dark room to create that ‘Japanese horror movie’ feeling.

Blueprint Breakdown: Light Cube

The light cube was great fun to create. We wanted to add animated light hues to the scene via a fully-dynamic physics actor spawnable by the player in-game.

The cube is a spawnable actor. It has a spotlight pointing down and a very faint point light in the centre. We’re driving these two lights via the Blueprint below, and we simplify the collision mesh to a box.

For the material we try to keep it as simple as possible; we work with the emissive property of the material and expose parameters for colour to be driven from the Blueprint and a few tweakables.

This Blueprint acts as the central place where we control the dynamic appearance of the cube, both in the shader and in the light components. We lerp the lighting and material colours over time. We initialise two variables with random numbers when we spawn the actor, which we use in our expressions below for creating the motion of the colour lerps using the game time. This is to ensure we don’t get multiple cubes changing colour in sync when the player spawns the light cube in the level.

We could extend this by storing the colours in an array and allowing the player to change and add desired colours.

Enlighten in 4 Bullets

  • We add our desired lights to the scene and animate them. Enlighten will update the diffuse bounce and dynamic cubemaps in real time, without having to rebake lighting into the textures.
  • To enable this, Enlighten creates a small indirect lightmap from the Static Mesh Actors. The game runtime or editor updates this lightmap in memory at runtime. We have presets for tuning the detail of the meshes, and achieving the desired mix of visual detail and runtime performance.
  • Enlighten creates light probes to integrate movable objects such as characters and the physics actors with the lighting around them.
  • Enlighten provides reflection cubemaps from the indirect lighting, which are updated in real time.

The Enlighten SDK is very flexible and is in constant development, and workflow may differ based on engine and integration choices.

Summary and Conclusion

These examples show how we combine UE4’s graphical features and Blueprints with Enlighten’s real-time global illumination to add more gameplay elements to lighting, while maintaining a believable look and feel.

by Geomerics, an ARM company

*Due to the closure of operations of Geomerics and related websites, some blog content pre-dating May 2017 may become unavailable. If you would like to request information about any missing content, please feel free to contact us through the inquiry page.

Free Trial / Purchase / Inquiry

Contact Form

Contact Us

Contact Number

TEL +81-3-5488-7481

go to top Enlighten