Fog tutorial

From Valve Developer Community
(Redirected from Reasonable fog tute)
Jump to: navigation, search
English (en)Русский (ru)中文 (zh)Translate (Translate)
Note how the fog doesn't impact the skybox

When you have fog in your map, you will most likely run into the problem that, while the geometry and models get affected by the fog, the skybox will not. You have several ways of fixing this.

Tip.pngTip:Match the fog settings in the sky_camera entity with the settings of your env_fog_controller for best results.

Matching Fog Settings with the Skybox

This fog looks good because it matches the skybox

For good looking fog, you'll need to match the fog colors with the skybox colors. You can always fall back on the settings Valve used in their official maps.

For our example, we'll be using sky_day02_10. If you're using this skybox, your env_fog_controller settings would need to be set like this.

Primary fog color: 176 192 202
Secondary fog color: 206 216 222

The settings above were used for the bridge section of Highway 17.

Alternate Method using tools/toolsblack

Using tools/toolsblack can be more effective at achieving proper fog

Alternatively, you can change the skybox brushes to the tools/toolsblack texture. The sky will no longer be visible, allowing your fog settings to color the sky.

Creating a Custom Skybox Texture

Understanding the creation of 2D skyboxes is important. A more in-depth tutorial on creating one is available here.

Much like a regular skybox, you'll want to create six UnlitGeneric textures, each named corresponding to their direction. Leave off the $nofog parameter, however. This allows the fog to overdraw the skybox, without the need for it blending in.

See also