Placing Cubemaps in Your Map
Cubemaps basically collect the surrounding lighting condition, taking into consideration of all the nearby light entities (including light from the light_environment from a window or door) and map them onto the surrounding reflective models and textures. There are two steps in building cubemaps.
The first is to place entities called (not surprisingly) "env_cubemap" in your map. You need to place one wherever there is a lighting transition (from bright to dark, or from one color of light to another). This is especially important if you have contrasting shadows. So if you have a complex map, you literally need them everywhere. In a medium-sized map, there are typically more than fifty cubemaps all over the place.
However, you need to place them carefully and methodically. Each cubemap should be placed at eye-level to the player (about 64 units above the floor), since the whole point of having cubemaps is to make shiny surfaces in the map reflect light appropriately to the player.
For our map, we shall place a cubemap entity in the small indoor room, another one in the dark corridor, one in the doorway leading to the outdoor area, and one more in T spawn. Bring up the Entity Tool (
Shift-E) and select "env_cubemap". Click in the 3D view to place each cubemap. Remember, each cubemap should be placed approximately 64 units above the floor level:
 Cubemap placements |
Buildcubemaps after Compiling
The second step in building cubemaps is done after you have compiled the map and loaded the map up from the console. I consider this a second stage compilation. When cubemaps are finished building, the .BSP file would have been written to again. You need to build cubemaps after each time you re-compile your map.
So load up your map from within the game, and from the console, type the command
buildcubemaps (autocomplete should finish what you're typing, assuming you're not making any spelling mistakes). The whole process can take up to ten minutes or more, depending on how many reflective surfaces are in your map and how many cubemaps entities you've placed in there. During the process, you can see various texture surfaces flashing across the left-upper corner of the screen.
For our little map, it should only take a few seconds. At the very end of the process, while the engine is writing the new information to the .BSP, there will be a long pause (but don't worry, the computer isn't frozen). You'll be notified by the console once the process is complete. Close the console to return to your map. You should notice the difference looking at the specularity of the USP handgun and other reflective surfaces in-game.