Knowledge Base - Fog Effect

Fog Effect


Fog of Various Colors
Figure 1: Fog of Various Colors

One of the fun features of ZDoom is simulated fog. Figure 1 is a screenshot of the example wad fog.wad which illustrates the effect of having fog of various colors. Since this special takes a red-green-blue color number, colored fog is possible, but doesn't always look very good. It is probably best to use the white range of colors for the fog and mist effect.

The simulated fog is achieved by using the Sector_SetFade special.

Sector_SetFade tag, rrr, ggg, bbb

  • tag: The tag of the affected sector.
  • rrr: Red component of the fade color.
  • ggg: Green component of the fade color.
  • bbb: Blue component of the fade color.

In fog.wad, the tagged sectors are initialized during map load with an OPEN script. It would also be possible to change a sector during game play as well.

#include "zcommon.acs"

script 1 OPEN
{
    Sector_SetFade (const:1, 200, 200, 200);
    Sector_SetFade (const:2, 0,   224, 224);
    Sector_SetFade (const:3, 224, 224, 128);
    Sector_SetFade (const:4, 192, 224, 224);
}

The engine has to build a color table for the affected sectors so there will be a noticeable delay when the map loads. For this reason, it is advisable to have dummy sectors set up with the fade if a sector has to be changed during game play.

Fog is a nice ambient feature of ZDoom and its ease of use only enhances this particular special.

Sources

ZDoom reference by Marisa Heit.

Back