Real Sun Path | Realistic Sun Movement and Longer/Shorter Days!

I don’t clearly know what exactly you’re doing but to my understanding, if you’re going to make a space game, I would highly recommend you using my 3D Atmosphere script 3D Atmosphere - Roblox where it already does what you are describing. The Sun’s texture is already customizable, and with accurate apparent diameter and refraction effects.

Hey amazing work man… everything is just so well prepared and thought off… Just one quick question, I’m unable to figure out how to make a real time script which works with this system, unlike the one it already has which simply just plays a cycle that isn’t synced with the real world.
Any help would be appreciated!

1 Like

Basically the ClockTime value inside this script is based on local solar time, with 12pm referring to when the Sun crosses the meridian on an average.

By default, the display time, which is on the game clock may be ahead or behind the ClockTime value (local solar time), depending of where you are on the ideal timezone, plus any DST offsets.

If you wanna sync with the actual Sun, you will have get the current time of the day in real life, and subtract it by the Sun offset, which can be found in the game clock, which this script comes with.

I may implement something like that for future updates but so far you will have to do a bit of math. The best part is that you will be working with decimal hours though.

Thank you! I’ll see what I can do with my kinda basic scripting skills lol

That’s pretty cool. The atmosphere module could change a lot of visuals in some games.

Heyy tysm again! I was able to make the cycle with a very simple script! The results are awesome and incredibly accurate!

Why did you use GuiMain over ScreenGui?

(it’s deprecated)

Alright it’s me again lol… I have an issue with the clouds… I wanted to add them to the game, however, with the 3d environment feature seems like they are set in the background and can’t be seen… What solutions can I try?

Unfortunately, the Roblox clouds aren’t compatible with 3D Atmosphere, hence why I had to use an improvised cloud system for the game I used 3D Atmosphere in. One way of improvising clouds is to stack decals and use a cloud texture. Then offset them on the XZ plane in random directions. This article has a great solution to the cloud problem: Volumetric Clouds: Phase 2!

I see… I’ll have to give it a try I guess… It’s a shame we cannot customise Clouds in any way
Thank you so much anyway!

Edit: I have thought about a way better alternative to this problem rather than using different clouds or not using the 3D atmosphere, here’s my idea:
Instead of simulating the upper atmosphere with a mesh, we could stick to Roblox’s built in sky box to replicate the same effect. This could be done by changing the sky box texture according to the Atmosphere color/texture value.
I believe this could be possible to implement and I think I could be able to figure it out (no promises lol) but I’ll need to actually get to know how’s the transition in the atmosphere’s colour to replicate the same effect on a decal, and that might be something I’ll need your help with (if you are willing to).
Thanks in advance!

This seems really nice!

I made a season system on my game that changes throughout the year and wanted to have the length of the day change with the seasons. Lets say I was a bit disappointed in Roblox’s system. I’ll take a look at this script for sure

Hi, sorry to bump this but I just discovered it, and it is exactly what I was looking for. I just had one issue. I noticed the sun/moon jittering or briefly going the opposite direction, especially at midday and midnight. I see that this is a known bug when refraction is enabled at the poles but I seem to be getting the same issue regardless of what the refraction or geographic latitude are set to. Don’t know if this is a bug or something I’m doing wrong but I would appreciate some pointers to how to fix it.

Edit: Adjusting the day of year to follow the time of day fixed some of the jittering but not all of it.

1 Like

Its a known issue, where if you’re at the poles, refraction will mess up during the midnight Sun. It can be fixed through more mathematical calculations involving a pivot, which Roblox’s Sun pivots on by default, which will be of unnecessary hassle, which refraction can easily be disabled when at the poles. Unless you’re making a planetarium game, players won’t even care about 1-2 minute deviations in the Sun’s position. Also for the Moon, unfortunately Roblox fixes the Moon at the opposite side of the Sun, which you’ll have to create your own Moon system, using this script as a foundation.

1 Like