Real Stars ✦ Add 1000 stars + sun + moon to your roblox sky

Real stars

Add 1000* real stars, the sun and the moon to roblox


Advantages

  • Uses Actual Real Life stars
  • The Moon and the sun are not locked together
  • Low Graphics Compatible
  • Works with Streaming Enabled
  • Customizable
  • Scriptable

Usage

In order to actually use and customize, you'll need to know a thing or two about scripting in roblox, but for general purposes, I have created some few template setup. First and foremost, Real Stars module can be used in both server and client, but In the example It'll only be client sided, As we also need the stars to follow camera.

Real-Time Stars at a location

Real time.rbxm (63.2 KB)
This example covers real time sky at a given location, start by downloading the rbxm and place the resulting folder into StarterPlayerScripts , Now after that, take a look inside the Real Time localscript inside the folder, there you’ll see lots of stuff, scroll down to

--VISUAL CONFIGURATIONS
local latitude =7.8383--Set latitude
local longtitude = 98.3454 --Set longtitude
local ttz =DateTime.now()

As you can see, you can set the location of the sky by latitude and longitude, positive means north and east, negative means south and west.

Eclipse Demo

Eclipse.rbxm (63.3 KB)
This demo sets the location and time to the 2024 eclipse at Cleveland, Ohio, USA, after which, the time will progress at 1000x normal speed

--VISUAL CONFIGURATIONS
local latitude =41.4993--Set latitude
local longtitude = -81.6944 --Set longtitude
local tt =DateTime.fromUniversalTime(2024,4,8,15,59,18)

as you can see, we set the location to Cleveland, Then the time to the start time of the eclipse, but remember, the system uses Universal Time, So the time of 15:59:18 for the start of the eclipse is actually around 11 o’ clock (it is somewhat inaccurate due to the complexities of solving moons location)

--TIME CONTROL
local dt = game["Run Service"].Heartbeat:Wait()*1000
ttz=DateTime.fromUnixTimestamp(tt.UnixTimestamp+dt):ToUniversalTime()
tt = DateTime.fromUnixTimestamp(tt.UnixTimestamp+dt)
year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second

Here we essentially get how much time has passed in 1 loop, then we multiply by 1000 to speed up, We then update the current time by adding the time passed times 1000 into ttz and tt

Analemma Demo

Analemma.rbxm (63.2 KB)
Here we essentially go forward in time 1 day every update, essentially going to the same time every day for a year. Now we also trace out the path of the sun

--VISUAL CONFIGURATIONS
local latitude =7.8383--Set latitude
local longtitude = 98.3454 --Set longtitude
local tt =DateTime.fromUnixTimestamp(1745131232)

We first set the location and the start time of the demo

--TIME CONTROL
ttz=DateTime.fromUnixTimestamp(tt.UnixTimestamp+86400):ToUniversalTime()
tt = DateTime.fromUnixTimestamp(tt.UnixTimestamp+86400)
year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second

We then go forward in time by 86400 seconds, Essentially a day every loop

--SUN
local ra,dec,lambda,Msun = sun.calculateSunPosition(JD)
local alt,az=constants.calculateHorizontalCoordinatesFromRA(ra,dec,latitude,LST)
local sunvec = constants.altazToUnitVector(alt,az)
sun.positionSun(sunvec,sunobj,loadpart)
sun.CreateSun(sunvec,3,loadpart)

We then update the sun’s position by using positionSun() and we create a trail tracking the sun by creating smaller sun every update


Documentation

Basic documentation for function use and outputs are provided when writing code

A few function you need to use

starcreator.LoadArr(database : Array , Part : Part)

  • Loads stars from a Database array, around a part as attachment at 2000 studs

starcreator.calculateLST(JD : number , longitude : number)

  • Calculates the Local Sidereal Time from longtitude and time precisely

  • Returns Local Sidereal Time in Decimal Hour

starcreator.LoadRot(latitude : degree , 90 + LST : degree , Part : Part)

  • Rotate a part to the appropriate rotation given latitude and LST
  • The 90 Degree is to account for initial rotation of the part that has original rotation as 0,0,0 when loadArr is called on the part

Any auxiliary functions should be documented when you try using it using the code editor


Limitations

  • It is accurate but in no way should be used for real world stuff like navigation
  • Verified by checking with Stellarium Which might be incorrect
  • Sun and moon will be included, But both will be off by a few degrees (Sun = Roblox sucks, Moon = Too complex)
  • Fog have to start after the stars (Offset)
  • Does not work with Roblox Cloud (Custom clouds untested)
  • Shadows are very inaccurate at night

Expanding

Check this Github page, This is the code used to create the JSON data string to be used in Real Stars


License

If used in any public project, just add "Using Real Stars by tin_nim" in description or somewhere in credits of the game

Get it

  • Module Scirpt [Does not include usage script]
    All demos are provided above

Notes

  • Only top 1000 brightest (Apparent Magnitude) stars are added
44 Likes

oooo~ I would love to see how this resource expands in the future!

absolutely beautiful, I would love to see how this progresses in the future. I will be using this system in a future project.

The sun will be added soon

2 Likes

Hi,

Shoot, I am out on at sea on my boat, and using Roblox for my navigation system… it say it looks like I am near the Bermuda Triangle from the stars… I have been going in circles for days…

on another note…

  1. Do the stars move across the sky?

  2. You said they are always visible?? even during the day? isn’t there a way of turning them off?

  3. can the star be programmed to move, not relative to the time of day, if that is how they move, if at all ?

Thanks

1 Like

1.Yes it does move across the sky, In the example script however is real time, so it is very slow

2.Yes there is a way to turn them off, Just loop through the part used to store GUIS and change the transparency of image label, I will soon upload a new script that has that feature

3.They move like in real life in the example script, Where changing the Universal Time , latitude and longitude will change the stars position accordingly.

Now currently the star movement is not influenced by day time at all,

while task.wait() do
	ttz=DateTime.now():ToUniversalTime() --Set time to UTC
	year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second--Expand the time
	year,month,day,hour,minute,second=tonumber(year),tonumber(month),tonumber(day),tonumber(hour),tonumber(minute),tonumber(second)--Deprecated, Used for os.time applications
	starcreator.LoadRot(latitude,90+starcreator.calculateLST(longtitude,year,month,day,hour,minute,second)*15+,workspace.Part)--Rotate workspace.part, 
end

In the script as you can see, you can change the rotation of the stars by changing the inputs of the LST function, so for example freezing the star in place you would just delete the looping and input ttz to be a constant
for changing speed or rate, you can do that by changing ttz by some amount for example 2x speed would be

local starttime = .....
while task.wait() do
    local delta = DateTime.now().UnixTimestampMillis - starttime.UnixTimestampMillis 
	ttz = DateTime.FromUnixTimestampMillis(starttime.UnixTimestampMillis  + delta*2):ToUniversalTime()
    --Set time to UTC
	year,month,day,hour,minute,second=ttz.Year,ttz.Month,ttz.Day,ttz.Hour,ttz.Minute,ttz.Second--Expand the time
	year,month,day,hour,minute,second=tonumber(year),tonumber(month),tonumber(day),tonumber(hour),tonumber(minute),tonumber(second)--Deprecated, Used for os.time applications
	starcreator.LoadRot(latitude,90+starcreator.calculateLST(longtitude,year,month,day,hour,minute,second)*15+,workspace.Part)--Rotate workspace.part, 
end

I really hope once this is complete, people will start using it and roblox will make it the default for new games!

1 Like

This is super cool! thanks for the resource.

BTW, the stars show through clouds.

1 Like

That is due to the fact that stars are billboard GUI, which will always show through clouds as the clouds are not actual 3d objects… There is no fix, the only one I can think off is to manually project the stars unto the cloud texture, and manually dim it

1 Like

Added the sun and the moon, Publishing tomorrow, Documentation is in the code suggestions.