Course contentsShow
← Unreal Engine Game Development
Lesson 509 of 8807. Visual Fidelity and RenderingFree lesson

Creating Dynamic Time of Day Lighting

Implement a sun and sky system that updates Lumen global illumination in real-time as the light direction changes.

In this lesson, you will learn how to synchronize your sun and sky system with Lumen’s global illumination to achieve seamless real-time lighting transitions.

When creating a dynamic time-of-day system, the challenge is ensuring that Lumen—Unreal’s dynamic global illumination and reflections system—updates its lighting representation as the sun moves across the sky. Lumen relies on a Surface Cache to calculate indirect lighting; if this cache doesn’t refresh as your Directional Light rotates, the bounce lighting will appear static and "stuck" in the old orientation.

Configuring the Light for Dynamic Updates

To enable real-time updates, your Directional Light must be set to Movable. When the light is Movable, Unreal automatically flags the scene for a Lumen update whenever the light's rotation changes. However, for smooth performance during a time-of-day cycle, you should monitor the frequency of these updates.

In your Blueprints, you can drive the rotation of the sun using a Timeline node to interpolate the rotation of your Directional Light. Use SetActorRotation to update the light's transform:

// Example logic: Updating light rotation based on a timeline float (0.0 to 360.0)
FRotator NewRotation = FRotator(TimelineValue, LightYaw, 0.0f);
SunLightActor->SetActorRotation(NewRotation);

Optimizing the Lumen Surface Cache

As the sun moves, the Surface Cache needs to re-capture the scene’s lighting. If you notice flickering or lag during transitions, verify your Lumen Scene Quality settings in the Post Process Volume.

For dynamic time-of-day, ensure that your Sky Light is also set to Movable and has Real-Time Capture enabled. This allows the Sky Light to update its cubemap contribution as the sun lowers toward the horizon, preventing the "glowing" effect often seen when a bright sun is behind a mountain but the ambient lighting still reflects a high-noon sky. By pairing a Movable Directional Light with a Movable Sky Light, Lumen will continuously re-calculate the indirect bounce lighting based on the latest scene captures, resulting in a cohesive, natural transition from day to night.

Key Takeaway: To ensure Lumen updates correctly during time-of-day transitions, both the Directional Light and Sky Light must be set to Movable, allowing the Surface Cache to dynamically recalculate indirect lighting as the sun’s orientation changes.