Tutorial: Environment Last edited 1 year ago2022-09-01 11:26:54 UTC

Download example map

There's a few key things to think about when looking at your map from a high-level view. The "environment" is the overall atmosphere of your level, and spending a small time tweaking the options can make a lot of difference in your map. The most important things you should look at are the skybox and the ambient lighting.

Environmental elements

The Sky

First you will need to create a sky. This is actually pretty simple: find the outside brushes of your map (the ones that look out towards the sky), and apply the sky texture to them. In the editor, this will appear as a light blue texture, but the engine will turn it into the skybox when it runs.

To tell the engine what skybox to use, click on the Map menu and open Map Properties. In the Environment Map box, just type one of the below names.

There are 19 included skies that you can use (you can find them in the gfx\env folder), and they are called:

Lighting

If you've got a large outdoor map, you've probably realized that normal light entities just don't work that well... the best thing to use is the light_spot. Although it may seem even less clever to light up a whole map with a spotlight, it actually works quite well, providing you turn the Is Sky property on. This makes the light far more wide-spread (well, it's emitted from the sky...), so it lights the outdoors up well. You might need to change the Pitch, Brightness and the Angle, but everything else you can leave alone. Pitch is a value where 90 is straight up and -90 is straight down. Brightness is a setting where the first three values are for the amount of red, green and blue (i.e. colour), and the fourth is brightness. Click Pick Color to choose the colour easily, and set the brightness manually. 50 worked for my map.

One thing that improves with this kind of lighting is the way shadows are cast. Often, if you just use a normal light entity, the contrast between the bright and dark areas is very high. With light_spot, set to act as the sky, the balance is far better. On the example screenshot, below, you can see that the shadow cast by the boulder is not too dark. Replace the light_spot with a light and it will look unrealistic.

An entity more specifically designed for outdoors maps is light_environment. Experiment with that, especially the Pitch setting. Try adding a -35 Pitch and see how the shadow is formed. Just remember that you only need 1 light_environment per map, regardless of where the skies are. It just has to be in the map.

The example map

The Boulder

While I'm talking about the boulder, I'll just point out that I've raised it one unit off the ground. This is because if it touches the ground, it splits the ground up a lot. This is bad for several reasons, mainly from a performance point of view, because it gives the game engine more to render, but also the splits may appear funny on some systems, with little white dots and lines all over the place. One other way of preventing the break-up is to turn the rocks into an entity (func_wall would do). The problem with that is that the rocks won't cast shadows.

Clipping

If you are using Zoners Half Life Tools (from Version 2.0.0 onwards) as your compiling tools, then you don't need to manually clip the sky. Zoners tools will automatically add a clip brush to any sky brushes when you compile. However if you do want your player to fall through the sky, you must add -noskyclip to the command parameters for the CSG compile.

Zoners have also addressed the problems associated with Sky texture. Before Version 2.5.0 you had to make sure that the Sky texture was on all faces of the sky brush. Version 2.5.0 onwards allows SKY texture on any world brush without generating a mixed face contents error. All the faces inside a 'sky area' should be sky to help hlrad out by not having allocate lightmaps for faces inside the sky areas.

Finally, just note that for this tutorial I've used a boxed-in map. This is NOT a good idea, especially for complex maps, or maps that also have indoors areas - if the player doesn't need to see the sky, there doesn't need to be a sky brush there!
Some lovely shadowsSome lovely shadows

1 Comment

Commented 13 years ago2011-03-28 23:52:03 UTC Comment #100482
This half-life sky list contains pictures of each one:
http://halflife.qeradiant.com/halflife/tthl1.htm

You must log in to post a comment. You can login or register a new account.