Picture format

Many of the Doom Engine graphics, including wall patches and sprites, are stored in the WAD files in a special picture format. Notably excepted are the textures for floors and ceilings, which are known as flats.

Details of the picture format in Doom are given in the Unofficial Doom Specs.

A picture header gives its width and height, and offset values. Following the header are pointers to data for each column of pixels; the number of these pointers is equal to the picture width.

The data for each column is divided into posts, which are lines of colored pixels going downward on the screen. Each post is described by its starting height (relative to the top of the picture) and number of pixels, followed by a value for each of the pixels. Picture descriptions can (and do) skip over some pixel positions; these pixels are transparent. (Since transparent pixels are not changed when drawing a particular picture, whatever was drawn into the frame buffer previously will show through.)

Each pixel is given as an unsigned byte (and thus is valued from 0 to 255). The pixel value is first used as an index into the current COLORMAP, which gives a new pixel value (from 0 to 255) adjusted for the desired light level. (At full brightness, the pixel value is unchanged.) Then this new pixel value is used as an index into the current palette, which yields values for the red, green and blue components of a particular color (each value ranging from 0 to 255). Each color component value is then replaced using the current gamma correction lookup table, a user-adjustable setting that can lighten the colors for dark-looking monitors. (When gamma correction is off, the color components are unchanged.) The resulting red, green and blue values are stored at the proper position in a frame buffer, for eventual output to the display hardware when the rendering of a frame is complete.