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. 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.

The light amplification visor is implemented by ignoring brightness values and using colormap 0 for all sectors.

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 the normal palette during invulnerability.

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