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, with colormap 0 being the brightest and 31 is the darkest. Walls, flats, and sprites are assigned a colormap based both on the sector they are in and the distance they are from the viewer. Walls additionally have their colormap modified by what direction they are facing. Colormap 6 is used to give a sprite partial invisibility by remapping pixels behind the object to darker shades of nearby pixels. This is replaced by the TINTTAB function in Heretic and Hexen.

The light amplification visor is implemented by ignoring brightness values and using colormap 1 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, because of the Invulnerability colormap bug, the sky is always painted using colormap 0 regardless of invulnerability.

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