# Infinite Range, Smooth, Day-Night Cycle

Could somebody please tell me how to implement a day-night cycle with smooth transition that has no limitations placed upon its range.

Firstly, I would like the sun and moon to move smoothly across the sky.

Secondly, my terrain is infinite. Therefore, I would be grateful for a sky that is infinitely far away.

However, if you have a solution but it proves me wrong about either of my conclusions, please tell me about it.

Now, If i was to actually take a shot at an “answer” I’d say :

Have you thought about making the sky a set distance from the player (or the camera).

What i’m seeing is some sort of a sphere (huge, indeed) that has the sky on it (a sky dome), and has a moon and sun rotating around it. That sphere could be attached to the camera or the player. that way, it gives the illusion of “infinite” as you’re never getting any closer to it.

My own personal method is to use a Sphere as above, delete the mesh renderer (or just disable) attach a directional light source at a point (Preferable at 92 Degrees so its beyond your horizon / below your terrain) this will be your “Sun”

you will then need to declare a simple sec/min/hour/day float to say that 1 day = 24hr, 1 hr = 60 min, 1 min = 60 secs

basically then rotate the sphere by adding setting your objects transform rotation equal to current time (A variable, float) + Time.deltaTime, Which should rotate per second.

I can write a longer response later on if needs be.

Hello Justice, my advice: Follow the BurgZergArcade tutorial series about Day Night Cycle beginning with this video. As for the infinite sky distance, may be once you have finished your Day Night Cycle, you are skilled enough to implement this feature by yourself, or may be it would be enough to let all relevant sky objects move along with/rotate around the player.