3D Skyboxes

Credits

Submitter
  • P2: Drudge
    Points: 1,439
  • C1: Member
  • A5: Veteran
    Account Age: 6 years
rickets007 (Creator/Co-creator)
Key Authors
rickets007

Rating

8.8/10
Based off 20 rating(s)

Additional Info

Genre
Mapping
Difficulty Level
Intermediate

Stats

Post Count
50
ViewCount
20,557
Date Added
6 years ago
Date Modified
3 years ago

Skybox Tutorial Updated: 10/31/07

1/16=0.0625

Before you even think about making a 3D skybox make sure the general map layout is complete. It is most important that the outer most walls are in their final positions.

First, let's go over what a skybox actually is. A skybox contains everything that can be seen outside the playable area of a map. This could be hills, trees or buildings that can be seen in the distance when looking over the outer walls of a map. A skybox has two main components. The box itself, and the 'sky_camera' entity. The box is a 1/16 scale, sealed area separate from the playable area of a map, that contains all the outside scenery.

To describe the 'skycamera' entity, consider the following. In hammer when you zoom all the way out in one of the 2D views you can see the entire grid. The center of this grid is the intersection of the thick green lines. This point is defined as coordinate 0,0,0 or the exact center of the building space. It is traditional to build a map with this point being near the center of your level. The 'skycamera' entity is a way for the skybox to reference this point. This way the skybox can be automatically moved to "surround" your map and it will also be properly aligned.

For example, let's say you build your map and you wish to add a skybox. You would create a small enclosed box outside your level and place all your background scenery inside. Then you place a 'skycamera' entity somewhere near the center of this box and compile your map. The game engine will take the box with the scenery inside and make it 16 times larger. The game will also move the box so that the 'skycamera' entity inside it, is exactly at the coordinates 0,0,0. If you have not taken the time to properly align everything, this could produce poor results. For example, some of the things in your skybox can appear in the middle of your level or too far away to see.

The following will teach you how to align your skybox perfectly. The included screenshot shows the skybox boundary in one of my levels. It is aligned so well that the boundary is almost invisible. The red dots mark the skybox boundary and the arrow points to a misaligned texture.

The first step in creating a 3D skybox is to place a temporary 'skycamera' entity at the coordinates 0,0,0. This does not necessarily have to be inside your level but it most likely will be. Then, select the 'skycamera' entity along with some of the main features of your map layout, especially the outermost walls. Only select brushes or displacement surfaces. Use the "copy" command on the selected objects then under "edit" select "paste special". The default settings are fine so just click 'OK'. You will now have an exact copy of your selection. This needs to be scaled down to 1/16 its original size. Make sure the copied material is still selected and right click on it. From the menu select "transform". We are interested in scaling to 1/16 size, so select "scale" and enter 0.0625 in for the x,y and z fields. (0.0625 is the decimal equivalent of 1/16) Now move this tiny version of your level to an out of the way location in the build space. Make sure to move the 'skycamera' entity along with everything else. The position of the skybox doesn't matter because the 'skycamera' entity will align the skybox for you. This next step is important. You must delete the original 'sky_camera' entity located at 0,0,0. Make sure not to delete the one that goes with your skybox.

At this point you should have your original level without a skycamera entity at 0,0,0. You should also have a shrunk down version of your main map geometry with a skycamera entity. It is now time to start building the skybox. Construct a box around your miniature map layout. The size doesn't matter but don't make it excessively larger than needed. You may now add background scenery to your level using the scaled down map geometry as a guide to help you judge the placement and scale of whatever you add to your skybox. This "reference geometry" must be removed before you compile. In addition to the scenery, two identical 'light_environment' entities should be added; one in the skybox and one in the main map area, to create sunlight. Remember, when you play your map in-game, it will appear that your entire level is inside this skybox and that the background scenery is 16 times its original size. Because the actual size of the scenery is very small, it is less work for the engine to render.

To see the skybox properly from in-game, make sure the parts of your level where you can see outside sky are textured with the "toolsskybox" texture. Another way to think about it is that you could build your level and just leave it open wherever there should be sky. To prevent leaks you can place brushes with the skybox texture over the top and sides of the open areas. These brushes are not visible in-game but will make the skybox visible.

Your skybox should now be operational when you compile your map. Using a skybox is much easier on your system than building full scale background scenery around your map.

If the boundary of the skybox is visible from the playable area of the map, such as in the included screenshot, an additional step has to be taken. All the outside walls of the map must be built to a grid size of 16 or larger. This is because when scaled to 1/16 they must still lie exactly on the grid, otherwise it is impossible to align the rest of the skybox so exactly. If you are off my 1/2 of a unit in your skybox there will be a gap of 8 units in-game.

  • You must be a member

Comments

    • P1: Beggar
      Points: 156
    • E1: Helper
      EF: 1
    • C1: Member
    • A4: Graduate
      Account Age: 3 years

    Pros: it explain almost every thing about the 3d sky box.

    Cons: the tutorial does not explain where it comes from the 1 / 16, which is the default scale, but can be changed easily, just change the number that is in the properties of "sky_camera> 3D skybox scale", then this instead use the value 0.0625, just do the division of 1 / X, where X = "3D skybox scale" to change the scale of other objects that either the 3d skybox. This can be very useful because the objects placed in the 3d skybox will only be magnified by the X that can be less than 16 (default value).

    Improvements: it should have the info i put in the cons, and it should have some highlights in the most important parts of e text(tutorial).

    Notes: if the people want to learn more about the 3dskybox they shoud decompilate a map an see some things.

    I try ;)
    • C1: Member
    • A4: Graduate
      Account Age: 3 years

    I try but i cant do it right :/ think of making a vid it will be very helpfull :P

    • P2: Drudge
      Points: 1,755
    • E1: Helper
      EF: 15
    • C1: Member
    • A5: Veteran
      Account Age: 5 years
    Posted by MrCheeseman Pros: Very easy to understand Cons: Not so much detail, took me a long time to read. Improvements: make shorter Notes: Nice job

    This was REALLY hard to understand. I almost got lost in the confusing of words thrown in to form bigger paragraphs. It looks like this tutorial is more a form of quantity more than quality, Im extremely lost on how to make a 3d skybox still.

    Honest Critiques For Free!
    • C1: Member
    • A4: Graduate
      Account Age: 3 years

    What you mean by a box do you mean a cube with no inside or just a box box like [¯¯] that with no inside ¯¯¯

    Bananite
    • P1: Beggar
      Points: 383
    • E1: Helper
      EF: 1
    • C1: Member
    • A4: Graduate
      Account Age: 3 years

    When you were describing the reference geometry in this tutorial, were you talking about the scaled down version of the map? I'm guessing that's what you were talking about but I wasn't sure...

    Do or Die
  • Anonymous

    Well, it is quite confusing, and not easy for beginners, but kudos for making it!

    • P5: Peddler
      Points: 123,048
    • E1: Helper
      EF: 12
    • C2: Ripe Member
    • A5: Veteran
      Account Age: 4 years
    Burnfingers

    Good tut. i get the following error in my compile log about 2000000 times. note to all mappers: 3D sky boxes DO NOT support alpha (blending).

    Material NATURE/BLENDGRASSGRAVEL001B uses unknown detail object type coastline_redgrass03!
    more gun = more fun
    • P2: Drudge
      Points: 6,042
    • E1: Helper
      EF: 17
    • C1: Member
    • A4: Graduate
      Account Age: 4 years
    Posted by banda Where can i download this i cant find ?

    you don't download it, its a tutorial. It tells you how to make one.

    And... here...we.........go!
    • C1: Member
    • A4: Graduate
      Account Age: 3 years

    Where can i download this i cant find ?

    Bananite
    • P1: Beggar
      Points: 97
    • C1: Member
    • A4: Graduate
      Account Age: 4 years
    Posted by CC_Fight What do you mean by reference geometry

    Any brushes made within the map to take the ease off of working out the actual brush.

    Nostaglica(DONT COPY)
  • You must be a member