Day / Night Cycle – Unreal Editor

I wanted to investigate how to create an adjustable day to night cycle using Unreal Editor, analysing how the lighting affects the look and feel of an environment. My ultimate intention is to create a cycle which is adjustable at the choice of the player, whether it be with a slider widget or a simple choice of day and night.

I scoured the internet for tutorials on the matter but any decent ones were hard to come by.  To get me started however, I created a scene where the directional light source and the sky box rotated on the y axis in conjunction with each other.  This gave the impression of the sun rising and setting, with the sky box providing a day and night scene.  This was created all within a blueprint.

DatNightCode

The blueprint also included a real-time day system using floats using calculations which represents days, hours and minutes.  The speed in which the day goes by can be edited using the “Day  Length in Minutes” variable, this will come in handy for quicker transitions from day to night.

The code in motion is shown below:

DayNight1 DayNight2DayNight4 DayNight3

Now, I want to add some sort of lateral movement to make the suns movement more realistic, also to include a moon into the sky box.

Finally, adding some kind of interface which will allow the player to change the time of day on the fly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s