3DSkybox - A way to create more immersive skyboxes for your game

This is cool, thank you for posting this!
:+1:

1 Like

This is really cool and I’ve been playing around with it in various projects with some fun results. I am curious how you got the moving part to work fine though. I’ve attempted several solutions and any part that moves just fine in the workspace is frozen in the viewport.

EDIT: After playing around with it a bit more, I’ve discovered that beginning the simulation with an empty 3DSkybox Viewport and dragging the moving object from the Workspace directly into my player’s GUI folder causes the object to move in the Viewport as intended. How can I work around this and allow the object to move straight from the StarterGui? I’ve tried programming the object to parent itself to the Viewport in the StarterGui after first loading in the Workspace to get the movement script working, but then it doesn’t update with the player’s own Gui folder.

3 Likes

Since it’s a ViewportFrame, it won’t simulate any physics (So no Motor6D animations etc), in the example pyramid above, I just used a simple script that updates the pyramids CFrame each frame.

game:GetService("RunService").Heartbeat:Connect(function()
	pyramid.CFrame = pyramid.CFrame * CFrame.Angles(0, math.rad(0.5), 0)
end)

I believe there are some methods which allow you to create animations within a ViewportFrame, however, if I remember correctly, they use a similar hack to what you described originally (But updating each frame, which could be quite costly).

2 Likes

This brings me back to the HL2 and Portal 2 days, where Valve projected skyboxes using a similar method.

Good work! Can’t wait to mess around with this idea.

6 Likes

I set it up exactly as it is in the description, but it doesn’t work.

3 Likes

i need help i cant set it up :frowning:

2 Likes

A bit unrelated, but did you use DEM earth for the terrain?

1 Like

Hey. Sorry for bothering, but I can’t seem to get it working. I placed the 3DSkybox model into the starter gui, but nothing happens. Looking forward to any help :slight_smile:

@jsmaller

1 Like

AMAZING! Looks like the lighting in sandtown map, arsearnal.

1 Like

You will need to insert an object or model into the ViewportFrame, then change the position of the object to better suit the camera IIRC the default 3DSkybox model included a union object, but sometime ago it broke so I don’t think it’s visible anymore.

Basically, the Skybox camera is in a parallel workspace, where the position moves at a fraction of the speed compared to the real camera (Workspace.CurrentCamera), whilst matching the rotation. This gives the illusion that objects are bigger than they actually are (I assume this would break in VR though). In order to make this effect work, you need to position objects around the camera so that the effect is best achieved. You should be able to change some settings at the top of the script which should help sell the illusion.

I would strongly advice you to play around with the skybox (look at the script if need be) to get a better understanding of how to use it for your desired purpose. I personally haven’t done much with it for quite some time now.


I used WorldMachine to create the terrain, and I used the inbuilt Cinema 4D landscape tool to create the mesh terrain.

3 Likes

Nice. I usually use world creator and Cinema 4D.

1 Like

I want to apologize for my late response, and thank you for your help @jsmaller. I really appreciate you helping me, it really means a lot to me :slight_smile:

It turned out that I had done something wrong on my end, and I was able to see the union that was in the model from the beginning. However, the effect achieved was not as expected. I was only able to see the model far out, and away from me - it was in no way encircling my view.


I did not change any settings, it’s completely “stock” as you shared it.

I tried with some other models that were not unions and I got the same result. I’m probably just doing some settings wrong (albeit I have tried quite a lot to fix it).

With that said, I was planning on making a desert-ish roleplaying/wizard game where this 3DSkybox would’ve been perfect. So, I just got two questions.

Is there any way I can use Roblox terrain inside the viewport (or export it into blender, and then import the terrain as an .obj file? - and then use it?) Or could I maybe get your .obj file? And could you maybe just give me the settings that you used?

I know I am asking for much, and you probably don’t have the time to help me. But I would really appreciate it nevertheless.
Thank you! I really appreciate your help, I seriously do.

Sincerely, John.

1 Like

Since the skybox is just a ViewportFrame, it has all the same limitations of any other ViewportFrame — Roblox terrain does not work IIRC.

Are you using the version that is hosted on the forum? I would personally use the version found here. It is possible that when inserting the model into your game, you ended up moving the union too far — as even small distances look extremely large in the skybox.

Since the skybox camera defaults to the world-origin/(0, 0, 0), you will need to change the position of your objects accordingly — such as setting the position of a terrain mesh to something like (0, -3, 0), since that will place the terrain below the camera.

I again strongly recommend you to play with it to get a better understanding of how it works, preferably by running the game in Studio, and then changing the part position / rotation of the objects. This can be found under Players > PLAYERNAME > PlayerGui > 3DSkybox > ViewportFrame in the explorer window. By playing with the skybox objects in a live windows, it should give you a better understanding on how to use it, and once you’re happy with the settings you’ve chosen, you can always copy the instances under the ViewportFrame and then put them into the skybox under StarterGui.

In regards the the terrain mesh I used, I would recommend you to upload your own assets, since third-party assets used in your game could be deleted / archived at any time, whereas assets you upload gives you full control. I’m sure there are plenty of tutorials online on how to generate terrain in blender etc.
But if you really want to use the terrain mesh I used…

Terrain Used

Desert Mesh - Roblox
Position: (0, -0.2, 0)
Size: (25, 0.75, 25)

3 Likes

How do I make it so the skybox follows the player? Sorry if this is a dumb question.

1 Like

Hey, it’s just like Valve’s skyboxes!

2 Likes

You should make a MainPart which is at 0,0,0 and then group the parts inside the viewportframe, make the primarypart the mainpart then use SetPrimaryPartCFrame(CFrame.new(player head position))

1 Like

This reminds of working on the hammer editor.
Man this really brings me back. I haven’t played hl2 in forever.

1 Like

thanks to your code and a bit of scripting on my side,i created a procedural galaxy sky box where the stars look different on where you are on the map

it took a while but it works,it works by stars nearby to me looks small while farther one looks big to make a illusion of alot of stars but not really

Is there anyway i can make something like this into a skybox?

I’m having trouble using this. Also, is there anyway to edit the scale to make it look more like the garry’s mod map?

1 Like

All I can say is thank you! Thank you! Thank you! I can now force load my planets that are past the rendering distance. You truly saved my game! So sorry for the necropost but I had to express my un-ending thanks.

1 Like