COLORMAP

The COLORMAP is a 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 the engine still utilizes the partial invisibility effect).

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 unused. Originally used in the Doom press release beta for invulnerability, as colormap 32 was used for the light amplification visor effect. Id Software decided to use colormap 0 for light amplification instead, resulting in fullbright sprites, and removed the green map, shuffling the invulnerability map to the previous place; but they forgot to change the total number of colormaps to generate in their dcolors.c utility.