Download

Sunset/Sunrise, Day/Night cycle and ful dynamicl GI

Hi everyone,

After cutting my teeth for a bit on unreal and blueprints, I decided that i’d come here and share a useful snippet i have created.

My game uses the day/night cycle code from this tutorial with full dynamic global illumination enabled. However, there was a slight problem in that when the sun sets the light just ‘blinks off’, and turning off the sun lamp alone does not have the desired night-time effect as show in the picture.

Instead you can make the following change to the “BecomeDay” and “BecomeNight” events using a timeline object in the blueprint:

daynight-timeline.png

Each of the five floating point curves in the timeline are simple S-shaped logarithmic curves, and the colour change is from black to white, all acting over 16 seconds.

This also operates on the assumption that you have added atmospheric fog and an exponential height fog to your game, which i find at reasonable intensities gives more a sense of realism, but if left on during the night cycle obscures the stars in the sky and leaves the game in perpetual sunset.

Using the timeline above will give you a nice sunset/sunrise animation every time the game transitions between states, which looks a lot better.

As the tutorial says, you can use a matinee, but this works well as a programmable stopgap between matinees and what exists already.