COLORMAP

COLORMAP is a WAD lump which contains 34 maps that map colors down in brightness within a palette. Its main purpose is to allow Doom to show sectors with different light levels.

Each colormap is a table 256 bytes long. It is indexed using a pixel value (from 0 to 255) and yields a new, brightness-adjusted pixel value.

The first 32 colormaps (0-31) are used for sector brightness (and. Colormap 0 is the brightest and 31 is the darkest. Divide the sector brightness value (which ranges from 0 to 255) by 8, rounding down, and subtract from 31 to get the colormap to use. For example, a sector brightness of 7 uses map 31 while a brightness of 8 uses map 30. They are also used for giving an object partial invisibility by remapping pixels behind the object to varyingly darker shades (replaced by the TINTTAB function in Heretic and Hexen).

The light amplification visor is implemented by ignoring brightness values and using colormap 0 for all sectors (although still utilized it for partial invisibility).

Colormap 32 is used when the player has the invulnerability powerup: everything is painted in shades of grey, with black and white reversed and sector brightness disregarded. However, Doom suffered from the Invulnerability colormap bug, where the sky was painted using its normal color during invulnerability.

Colormap 33 is all black and its purpose is not known.