Advanced Day Night Cycle

UPDATE - 4.19

Updated to 4.19.

UPDATE - 4.15

Hi Guys , just updated the system with major performance optimization , so anyone who was experiencing a framerate lag can now get the dynamic daynight cycle in realtime.

Hi All,

My Advanced Day Night Cycle is finally released in the marketplace. So this thread will be a support and feature request thread.

Marketplace Item - DayNight Cycle in Blueprints - UE Marketplace

Short Description - This pack consists of a blueprint based daynight system with colour grading blend textures.

Long Description - This system takes into account the realistic Solar and lunar position based on latitude , longitude , time of day and day of year. It also contains several colour grading textures which blend over the period of 24 hours , from Dawn to Night. This system also calculates Lunar phases. A Clock system and a calender system are present to accurately calculate date and time.

Technical Details -

639 Lookup textures

2 materials and 1 material instance

2 main Blueprints and 3 widget blueprints

Kindly let me know if I need to send additional information.

The Blueprint performs the following main functionalities -

-Sets DateTime functionality, like Clock and Calender system based on given date and time.
-Calculates Sun’s elevation and azimuth angle and moon’s elevation and azimuth angle for a given date , time , latitude and longitude
-Calculates Moon’s age to accurately determine moon phases in a given date and location. Used a Spheremask for moon.
-Blends between different colour grading textures to choose the most accurate texture that fits a given time of day. For every transition between two different times of day (e.g dawn and early sunlight) , there are approx 40 colour grading textures blending within the time interval , so that the blend is smooth and not noticeable to the human eye. Along with the colour grading texture , the minimum and maximum brightness as well as the colour grading intensity in the post process element highly changes the look and feel of a given time of day, and that can be easily adjusted to get desired result.

Please note that in this pack the major focus was given to the blueprint functionalities rather than graphical quality, however if you want this pack to be enriched graphically as well , kindly request for any features here , and I will definitely try my best to add those features in the next release.

Thanks for your feedback. I will take a look at it as early as possible

I did the exact same thing for my project, no longitude but that would be easy to add. I also have the clock and can even make day and night differently in their duration (most games make night go faster than day because, well, it is dark)
I would have never thought of submitting.
If my game fails to be THE commercial success that built my retirement plan on, then I will sell all the bits and pieces that I did over the last months during every days work and get rich that way.

Nice work anyway. Just want to add that you should also include the option to make night shorter than day or the other way around. It is what many games do. They let the clock tick faster at night by a bit.

Creating games is not about getting rich… its about creating games :wink:

@ I like your package! I like the friendly indie price too! Keep up the good work.

Thank you for your suggestions, but shouldn’t night automatically get shortened based on the factors I included ? (longitude , latitude , day of year). I am not good in geography , so I did a lot of research , mainly in NASA’s official website , to get these equations close to reality. And night does get shortened during summer in India, so if you give the accurate latitude and day of year , you will get the exact result(not considering moon’s perturbations…yet)

I think MaZi1 has implemented shorter nights in his version not because of planetary accuracy but because the main focus normally in games is the day time ?

Two quick things -

How do you remove the select time/date menu on level launch?

And how would one go about making nights lighter? I tried messing with the moon or stars but nothing seemed to make much difference

Hmmm…good question whether it should automatically be shorter due to longitude/lattitude. I think you are right. Like short nights at summer and long nights in summer.

I have divided my 24 hours in 4 quarters and can stretch one of them or more while the remaing ones compensate for it. Anyway, it is all to have night for example only last 15mins real time and day 45mins real time if one cycle is 60mins real time. Just as an example.
I was more after exact ratios to know exactly how many real time minutes what takes.
Another useful thing I did was an overall variable to shorten or lengthen the cycle. It is good for testing, a bit like timelapse if you make it very short.

Hi ,

Yeah please remove the commented portion as shown below :

By lighter if you mean reducing the star brightness ,you can do it from the property editor of sky sphere blueprint instance. And if you want to make nights look brighter , you can definitely do it by 1>Increasing the Moonlight value in the main blueprint instant 2>Reduce the colour grading intensity variable value or unplug the common intensity value from the below snapshot(in construction script) and modify each colour grading intensity value separately.

’

To increase or decrease the brightness with greater accuracy , feel free to tweak the parameters in the below macro , mainly the min brightness and the max brightness portion.

In the color grading texture lookup structure , you can seperately add two more variables for min brightness and max brightness , and plug them in the above macro instead of using the common variable.

However , since there are 639 textures , you probably may not want to tweak them individually , in this case you can simply plug a for loop in the construction script and insert a condition that checks elevation angle below -18(evening to night) within the array and change the brightness values of the corresponding array elements as required

It is always better to test things yourself by plugging in the respective lookup texture in the post process instance present in the level and adjust the parameters manually to see exactly what value you would want to get desired result.

Let me know if you need further help

are you still working on the procedural building? also si this easy to implement into a project

Not a right thread but yes , it is really difficult and now that i am doing so by extending the editor , it is even more difficult and is going to take time. Please subscribe to my original thread since I will be soon uploading a video.

You can easily implement this pack into your own project , you just have to use my modified sky sphere and from the main blueprint, you can easily remove the widget creation portion

if i buy it will help me by guiding me through it

Yup sure , you can post any question you have regarding the content here ,and I will guide you through it.

Thanks for the quick response but that did not work. I tried upping the moonlight intensity, lowering the grading intensity, and both at the same time and night time is still pitch black. I need it to be dark, but still somewhat visible, at the moment you cannot see anything.

Hi ,

Actually you cannot change the moonlight directly from the property editor. In the main blueprint , you will see a comment section called as Set Moon Parameters , or you can directly find references of Moonlight variable to get to the exact location where you are supposed to make changes. See the below pic :

Here you can see that the moon intensity is calculated by multiplying moon phase with a value 0f 0.05. You can change the value to , say 4 or 5 to get brighter nights, but if moon phase is nearly equal to zero , this won’t be of significance , so you may want to clamp the result , to , say from 3 to 6 , or you can add a base minimum with this multiplication.

Also , you will notice that in the variable array called ColorGradingTexturesLookUp, the ambient cubemap intensity is given as 0.02 , you can create a for loop iteration and set the night time skylight intensity , to say 3 or 4, as shown below

Kindly let me know if you face further issues.

Hi,

Sorry for posting in the you tube thread. Hi have some questions. Here is one.

Play mode and working environment mode look very different as far as the sky system goes. When in play mode the sky is very dark blue. When I exit play mode, I get the nice light blue sky. I think this has to do with Horizon fall between Using Color Determined by the sun checked and unchecked. When it is enabled I can not use the Horizon Fall off slider. I think the sky is to dark and contrasty when Color Determined By sky is checked. How can this be changed?

Actually the play mode uses the colour grading textures to blend between different time of days, which is completely handled in blueprint. In the working editor mode , it is just the normal sky you are seeing , without any blueprint implementation. The colour determined by Sun variable is there in order to change the sky color based on the sun’s altitude, and you can turn it off and manually set the colour and horizontal falloff if you want to. Does this answer your question ? Feel free to post all the issues you are facing here , and I will provide a resolution, if any , and resolve them in the next update.

After studying the latitude and longitude for my project using winter and summer solstice, the sun angles seem to be ok. How do you handle GMT mine is -7.

Thanks,

Aaron

The things is when I build the lighting with Color determined by sun unchecked my sky plays back much darker and the overall scene is much darker than it appears compared to what i see in non play back mode. I will post some snap shots for you.

Image one is non play mode. Image two is in play mode. Notice how the lighting is very different.

c68374e0c00011d7a35be627e99ece2d8489947d.jpeg

361c8c07d12bedb3e33d358a36def7957bcd2be0.jpeg

Actually the GMT is automatically handled in blueprint and you just need to use the local time for the lat/long you are setting , and you are good to go.You can see a “Game DateTime” variable in the main blueprint properties, just use your local game time and date. And GMT will be taken care of based on lat/long