How do i create a spherical skybox?

Hey all, lately I’ve been working on a space game and i need to know how to create a spherical skybox so that my planets can have proper skies whilest still having a space skybox everywhere else. I also need the planet to be visible viewing from off of it. Any pointers or advice is appreciated.

3 Likes

Could you just use the normal skybox and check to see if a player is within the atmosphere of a planet?
If they are calculated to be in that sphere display that planet’s skybox. If they are outside the sphere display the space skybox.

2 Likes

Not sure but an inverted sphere may work.

did you look at anyone else’s post?

2 Likes

You could get a free model from the toolbox and change the images on them. I believe that some of them use decals for each face, so you can just replace the image ids with those of your skyboxes.

If they don’t use decals, you could export the model as a file then edit the texture png (hopeful it would come out in an easy to edit format).

Edit:

I thought they were talking about those older-style planets where the planet is a sphere and around the planet is an inverted sphere with a sky texture on the inside, so from inside the inverted sphere the player sees the planet’s sky.

Changing the skybox based on the distance is a great way to do it though. With separate meshes the sky can fade into view which can be cool, though it’s definitely more work to set up.

Here’s some rough code for changing the skybox:

-- LocalScript that goes in **StarterPlayerCharacter**

local PLANET_RADIUS = 500
local planet = workspace.SomePlanet  -- Set to some basepart with position at the center of the planet

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Lighting = game:GetService("Lighting")
local RunService = game:GetService("RunService")

local spaceSky = ReplicatedStorage.SpaceSky  -- Store your space Sky instance in replicated storage
local thisPlanetSky = ReplicatedStorage.SomePlanetSky  -- Store the sky for this planet in replicated storage

spaceSky.Parent = Lighting

RunService.Heartbeat:Connect(function()
    local character = script.Parent
    local hrp = character:FindFirstChild("HumanoidRootPart")
    if not hrp then return end
    
    if (hrp.Position - planet.Position).Magnitude < PLANET_RADIUS then
        thisPlanetSky.Parent = Lighting
    else
        thisPlanetSky.Parent = ReplicatedStorage
    end
end)
2 Likes

They didn’t actually ask for a skybox, they asked how to make the skybox change to a space skybox in a sphere around a planet.

2 Likes

well, i have a problem
i wanted it to be BRIGHT but roblox set the light range limit 60 that is kinda useless
and i tried make it neon, if only vertex color ofc i can use roblox material
but i got texture, maybe here anyone to tell some way make it light up?

What happens if you increase the Transparency of the Texture?

the shadow still there, roblox light not enough large, have texture cant make it neon
idk if there is more way to make it

I was talking about no light.
Make the sphere have Shadows false, make it Neon, and increase the Transparency of the Texture until the Neon starts to show through.

Although, in a case like this I guess the neon’s going to be visible from the outside…

let me test if 0.5 alpha sphere + texture will work like i can use neon…


becasue i realize i can make texture and material both stay at same time

seems it works

no… it dont work, no matter its neon it still have shadow if i put texture on
i think i need make the skybox texture 4 decals and put in my neon part

i give up, 4 decal is worse

Did you try making the light ‘CastShadow’ property false

its just make it wont make more shadows, but mesh same

I meant the Shadows property of the Lighting that is illuminating the sphere.
EDIT GlobalShadows

uh… future? i dont really get how you wanted to fix it

GlobalShadows is a property of the Lighting service, not lights that you add to the game.

1 Like

well, this is how i wanted my room looks like


but the cube room is small enough to use pointlight my is not enough,
thats why im looking for make whole part looks like neon no shadows

i want still have global shadows

Ah, ok, you didn’t mention anything about rooms and other shadows.

If you need more light in a room (or in the sphere) that’s bigger than 120 studs across you could add a few more PointLights spread around the room with the Range Property set the the maximum of 60 studs.

1 Like

hey… i have a good idea, i was learning viewportframe hours ago
i think i can use it with skybox in viewportframe

well, not skybox, sky is just for color i need a mesh/part to make sky but thats ez so its fine

yeah thats the solution

have you tried coloring the mesh with vertex colors?