Planetary atmospheres on Roblox

Okay, I want to make this clear now since I have a feeling if I don’t address this, more questions following the same pattern will appear.

Many times people get asked to be provided with a finish product. I completely understand that you, @NascarDriverBurak101 want to fix the issue you are having as fast as possible but a quote I learned, “Learning a person to fish will help more than to give that person a fish” is why I’ve not provided a finished product and just the atmosphere script.

I will not provide a earth model as the instructions that I will list again down below is made sure to be clear and simple to follow.

  • Begin by inserting the model, then following the instructions inside the model
  • Then to render atmospheres you start by Inserting a local script into StarterCharacterScripts
  • After that copy and paste it inside the newly added local script
Local Script - COPY & PASTE
local AtmosphereService = require(game:GetService("ReplicatedStorage").AtmosphereService) -- Gets module script responsible for AtmosphereService

local Atmosphere = AtmosphereService.NewAtmosphere(game.Workspace:WaitForChild("Earth"), 40, 400, .4, Color3.fromRGB(182, 194, 249), Color3.fromRGB(185, 255, 233)) -- Instances a new atmosphere

--[[ !WHEN CREATING ATMOSPHERES REMEMBER!

The first variable requires the parent for the atmosphere

The second variable explains the size of the atmosphere

The third variable explains the amount of 2D layers should represent the gradient sphere

The fourth sets the transparency of the atmosphere

The fifth variable explains the color and the last variable explains what color the transition from bright to dark there shall be.

]]

game:GetService("RunService").RenderStepped:Connect(function()
	AtmosphereService.UpdateAtmosphere(Atmosphere) -- Crutial for generating the shadows
end)

If you have any further problems that you’d like to discuss I’m happy to walk you through, thanks.

1 Like

I seem to have gotten it working, but is the interior supposed to be visible? I tried looking on the inside, but it’s extremely foggy.

2 Likes

Great that it’s starting to work!

For now the “interior” is not something you’re supposed to view, I’m hoping in the future I can work on the fact that it becomes extremely foggy when approaching the denser regions (or otherwise the centre) of the atmosphere but for now this is what happens.

If you want a object to be semi-visible but still foggy because of the atmosphere you scale the sphere to be close to the size of the atmosphere, not exactly although as that will in all cases fully obscure the atmosphere.

You can increase the transparency to be somewhere around .95 if you want a very see-through atmosphere which will in turn probably fix the issue you are mentioning.

Hope this answers your question and I wish you the best of luck in your game :wink:!

2 Likes

Will it be visible when your on the ground on the earth like in real life you can see the atmosphere.

1 Like

also i dont see the atmosphere when i run it or even play.

Heres what i wanted on bottom

Heres the script:

local AtmosphereService = require(game:GetService("ReplicatedStorage").AtmosphereService) -- Gets module script responsible for AtmosphereService

local Atmosphere = AtmosphereService.NewAtmosphere(game.Workspace.planets.Earth["Planet Pop up Text"].Atmosphere, 40, 400, .4, Color3.fromRGB(182, 194, 249), Color3.fromRGB(185, 255, 233)) -- Instances a new atmosphere

game:GetService("RunService").RenderStepped:Connect(function()
	AtmosphereService.UpdateAtmosphere(Atmosphere) -- Crutial for generating the shadows
end)
2 Likes

do not mind the laser that just hit earth
also its an model.

1 Like

Being on the ground, it won’t really look “ultra realistic” from my play testing experience. Only foggy in the day and dark fog in the night. But maybe if you change the variables to be just right the results might be just what you are looking for!

1 Like

I might need a little bit more detail on what’s going wring, maybe try opening the “output” window and showing me if there’s any errors happening. In case there isn’t try pressing Shift+P to enter free camera and then looking inside of the planet you have (this is to see if the atmosphere you are instancing is smaller than the object you want to cover)!

1 Like

Tried to. theres no script errors and the atmosphere didnt appear.

1 Like

also i looked inside the planet and theres no atmosphere in it

1 Like

Very strange, the last recommendations I can give to you is to double check if the parent you currently have is anchored since if not your atmosphere may just be falling into the void. In case that doesn’t work try inserting an anchored part and setting the parent of the atmosphere to be that part just to see if atmospheres can be inserted.

Otherwise I have no clue what your issue is with the given info I have. Hope this helps

edit: Check if the parent is one of these things “A model, an attachment or any base part

Its dissappeared when i played even when im looking it when im not in the play mode
and also the parent of the atmosphere didnt work.

Ok… Could you tell me where the script you are instancing and updating the atmosphere is parented? It’s recommended that you put a local script inside of either StarterGUI or StarterCharacterScripts.

Thanks you alot for this module, it was exactly what i needed for my space game!

I think i will try messing with disabling the atmosphere once entering the planet surface and then make my own one

1 Like


works amazingly, would recommend anyone making a space game uses this : )

2 Likes

how did you manage to get the sun to look like that? did you use a sun texture id? also what sky box is that? thank you.

1 Like

Shockingly enough, the sky box is procedurally generated! The sun was a random texture I found in the toolbox and same for stars. The sun and the stars are BillboardGUI’s, the skybox I have is completely black.

In case you want to replicate the sun flare effect I’d recommend you to search in the toolbox for textures or “flare effect” models and manipulate how BillboardGUI’s can move parallel and along with the screen given the offset variables given to them.

Hope this answers your questions, thanks for commenting! :wink:

3 Likes

This is an amazing module! I’ve used it in my game, and I would definitely recommend this for if you’re trying to make a space game.

1 Like

Is there any way to make the view “on-planet” better?
image

Yo will it use only a terrain planet im trying to chaange the one part to the perfect atmosphere (Earth)

also add a cloud atmosphere ver it will be perfectly cool lol