Picture format

Many of the Doom 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 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; the number of these pointers is equal to the picture width.

The data for each column is divided into posts, a line 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. 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; 255 is reserved as the "end of post" value). 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 adjusted according to the current gamma setting, a user-adjustable parameter that can lighten the colors for dark-looking monitors. 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 drawing of a frame is complete.