[Guide] Seamless 3D Skyboxes

Freyja

aa
Jul 31, 2009
2,994
5,813
Hey all, recently I've had a lot of requests to write a tutorial on how I do my seamless 3D skyboxes. A lot of the older tutorials are outdated or teach a method that makes making the skybox seamless with your map incredibly difficult.

Let's start with your map. Here I've created a small scene to demonstrate making a seamless skybox. You can do this with any shaped map, but I used a simple square here to demonstrate the technique easier.

Cm4IOaO.png


The key to the seamless skybox technique is to build your skybox around your map in real scale. Sew your displacements and align your textures here, the technique we use to create the skybox will keep these texture scale and alignments from this portion.

Don't place props in this portion, just create a simple base for your skybox out of displacement and brushes only.

Here I've created an area outside my "map" that will become the 3D skybox. As you can see here, the displacements sew with the map and the water and textures are aligned perfectly with what will say as the "map"

1p6nh5U.jpg


As you can see, I can select everything that will become part of the skybox seperately without selecting anything as part of the map.

om77gU9.jpg


The next step is to find your map origin, the 0,0,0 coordinate position. It is indicated by the three lines, one red, blue and green. You then need to create a point entity, change it's class to sky_camera and move it so it is sitting directly on the 0,0,0 point like this.

We do this because the sky camera is an entity that projects the 3D sky around your map from the origin point. By placing the camera at the origin now, we make sure that it is in perfect position to project our 3D sky exactly as it is represented in full size, seamless with your map right now.

XbYg4tr.jpg


The next step is to select your sky_camera and everything that makes up your skybox as shown earlier. It is an absolute imperative that you have the sky_camera select during this step along with everything else as it will not be able to be placed properly later.

Next, make sure you have both the texture lock and texture scale lock buttons turned on:

BYVLnAq.png



This will ensure that when we scale down our 3D skybox to 1/16th size, the textures will not become misaligned.

Next, hit Control-M on your keyboard, select the scale radio button and type 0.0625 (ie. 1/16th) into both the X, Y and Z boxes.

PEIB1SC.jpg


After hitting okay, this will leave you with a still currently selected, 3d skybox version of everything you had selected before. It will have scaled down everything, including the textures (because we had texture scale lock on) and kept everything in perfect relation to the sky_camera we had placed at the origin.

You'll want to drag all this stuff (Make sure texture lock is still turned on!!) somewhere off to the side of your map, it doesn't matter where, just don't put it inside your main map.

Q25SvWM.jpg


WLLqofH.png


Create a skybox box around your 3D skybox, making sure nothing inside it leaks. You'll want to make sure this is textured with skybox too, as it needs to cast light on your 3D skybox in order to appear seamless.

crGN8U0.jpg


You can now place skybox props here. As props do not scale with the transform tool (control-M) we cannot place them any earlier. Here I have placed some simple decoration props from the props_skybox/ section, such as phallic looking rocks and trees.

LvmswRZ.jpg


We also need to worry about the seamlessness between lighting and fog of our skybox and main map.

Your light_environment will produce the same light to both the skybox and main map, so as long as you don't have anything casting obvious shadows in the main map over the transition between normal map and 3D sky (the 3D sky will cast shadows over the main map, but not the other way around), source will take care of this for you.

The main concern is the fog. Find your env_fog_controller entity and your sky_camera (now positioned in the 3D sky area you made somewhere olff to the side of your map).

These are the settings that need to be identical in order for fog to be seamless. Often times you can play around withh these settings a bit and have them still appear seamless, but that's up for you to try. Making them identical will guarentee seamlessness.

kba1oUc.png


The last thing you need to worry about is if you have water crossing the border between map and skybox like I have here. Even though the water texture is perfectly aligned, due to the seperate physical positions in your VMF of the skybox water and real map water, their reflections will appear different and show a seam.

In order to fix this, create a cubemap entity above the water face inside your map. In the cubemap properties, you can select brush faces for the cubemap to affect. Select both the water face in your map, and the water face in your skybox. Once you hit apply, the cubemap entity will draw lines to the faces it is tied to, so make sure it's pointing to both.

AQVEJiB.png


And that's all there is to it, really. If we add a spawn point (because I forgot that) and compile the map, we can see that the skybox appears perfectly seamless with the main map. You can see where I have added fences to mark the transition between the real map and 3D sky from earlier. (Ignore the floating rock...)

OGk7qIw.jpg


However, there are a few issues you need to be aware of.

Firstly, here is an example of where a prop is casting a shadow onto the world that doesn't translate across to the 3D sky.

3xeb2qa.jpg


In this case, I would simply extend the real map to capture the shadow and start the skybox transition later, however often times you can get away with it.
Another issue you may run into is how water is handled across the transition.

nJpi08w.jpg


As you can see here, the refracive properties of the water doesn't work properly in the skybox, even though the texture is aligned perfectly. This effect is mostly evident from high angles, and you can allieviate it by increasing the depth of the ground under the water around where it transitions so the change is less evident.

The last issue you may run into is that of the fact that from certain angles, the 3D sky can be rendered behind props inside of your map.

rUntdUb.jpg


You can't really avoid this as that's just how 3D skies work, so I would suggest, as earlier, extending the real map and starting the skybox transition later.

I hoped this helped you make better 3D skyboxes. If you have any questions or issues, let me know below and I'll try to help.
 
Last edited:

Freyja

aa
Jul 31, 2009
2,994
5,813
Was the plane of water in the 3D sky and in your map on the same level? I think having them on different vertical levels can offset the reflection a bit.
 

Anreol

L2: Junior Member
Feb 21, 2015
60
273
Wow.
I suck making 3D Skyboxes... but with this now... will be a lot, LOT better.
Thanks!
 

tyler

aa
Sep 11, 2013
5,102
4,621
A lot simpler and easier to understand than the old skybox tutorials. I bet this will help lots of people.
 

Idolon

they/them
aa
Feb 7, 2008
2,105
6,106
It might be worth noting that you can place props before scaling your map down, provided that you make sure that a 1/16 scale version is available (and that you change the models yourself). This is really handy for lining up power lines and train tracks that extend into the 3d sky.
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
It might be worth noting that you can place props before scaling your map down, provided that you make sure that a 1/16 scale version is available (and that you change the models yourself). This is really handy for lining up power lines and train tracks that extend into the 3d sky.

Oh, so that's how it's done. Years mapping and I still learn new tricks.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
And if you have actual lines on your telephone poles, don't forget to reduce the thicknesses of the keyframe_ropes to 1/16 of what you're normally using.

As far as casting shadows onto skybox props from things in the regular map, have you experimented with putting either nodraw or blocklight brushes in the skybox that match the scaled-down dimensions of the thing in question? Does it present any issues, or would it work perfectly?
 

Freyja

aa
Jul 31, 2009
2,994
5,813
As far as casting shadows onto skybox props from things in the regular map, have you experimented with putting either nodraw or blocklight brushes in the skybox that match the scaled-down dimensions of the thing in question? Does it present any issues, or would it work perfectly?

It wouldn't be perfect unless you scaled the lightmap in thhe skybox down to match the 1/16th scale, however other than that it should work. Usually I just avoid the problem by avoiding it all together or casting shadows that are not noticeable by the player.
 

wareya

L420: High Member
Jun 17, 2012
493
191
Was the plane of water in the 3D sky and in your map on the same level? I think having them on different vertical levels can offset the reflection a bit.

yes the brush geometry and texture scale/alignment were seamless
 

iiboharz

eternally tired
aa
Nov 5, 2014
857
1,291
It might be worth noting that while building your skybox geometry at full scale, you should take care to not create any brushes or smaller than 16u because when scaled down it will become a microbrush and that would cause a mess of problems.
 

Pocket

Half a Lambert is better than one.
aa
Nov 14, 2009
4,694
2,579
It wouldn't be perfect unless you scaled the lightmap in thhe skybox down to match the 1/16th scale, however other than that it should work. Usually I just avoid the problem by avoiding it all together or casting shadows that are not noticeable by the player.
I didn't mean stuff that's meant to be lined up with the stuff inside the map, like that example you showed; I just meant any structures that ought to have shadows on them, like the silos in Foundry. Good to know there wouldn't be side effects.
 

ibex

aa
Sep 1, 2013
308
528
I've been using this for crusoe, but i've been having the issue where water further away reflects differently to water nearby - and even with the cubemap set up correctly, this creates a very visible seam, as seen below:
Any suggestions on what I can be doing?

I think Fubar or someone had said that you need a brush on the edges of your water that is the same color as your fog. Could be remembering wrong, but hopefully someone else has a more exact idea.
 

phi

aa
Nov 6, 2011
832
1,815
Definitely don't need a weird brush like that for your water to work. I don't have anything like that in Sunshine. You sure your cubemaps are working properly? That looks suspiciously like a reflection of the skybox.
 

LeSwordfish

semi-trained quasi-professional
aa
Aug 8, 2010
4,102
6,597
@Egan very helpfully provided the answer in chat - this distance is where the water fades from cheap to expensive as part of the water_lod_control's function - I extended that distance and now it works perfectly. Incidentally the same applies for when the water fades to a darker color or to more strongly purple checked, since the cheap water's appearance is controlled by reflection.

Thanks for the tutorial!