From ZDoom Wiki
Jump to navigation Jump to search
For more information on this article, visit the Flat page on the Doom Wiki.

In the original Doom engine, a flat is an image that is drawn on the floors and ceilings of sectors. Since the original Doom renderer draws walls and sprites vertically (column after column), but floors and ceilings horizontally (line after line), the native Doom format for flats is a row-major raw image format.

Flats are contained in their own namespace, represented by the F_START/F_END markers. Doom flats are all 4096 bytes, each describing a pixel by the index to its color in the palette.

Heretic features a few 64x65 flats, and Hexen a few 64x128 flats. Those were used to "cheat" with the implementation of scrolling effects. ZDoom does not need the same hacks to make flats scroll properly, and therefore ignores the excess pixels in these flats.

Finally, as an extended feature, 128x128 and 256x256 flats are supported as "hi-res" flats, which will be automatically be scaled down to fit in a 64x64 map unit square. This feature has since been deemed a bad idea, however it is retained for the sake of backward compatibility. Additional features, such as ACS functions, TEXTURES definition or UDMF properties, allow to correct the scaling if needed.

However, ZDoom features a unified texture manager which allows to use any of the supported image formats anywhere. There exist therefore the need to make the distinction between the three different things that "flat" may mean in ZDoom:

  1. The image format, which technically has no significance for ZDoom. The texture manager will convert it to an internal format when the flat is loaded.
  2. The namespace, which is used to prioritize lumps with identical names. If both a flat and a wall texture have the same name, and a sector uses that name for its floor or ceiling texture, the image which is in the flat namespace will have priority. Another effect is that intermission backgrounds and similar pictures, if they are in the flat namespace, will be tiled (instead of stretched to fit the screen).
  3. The texture placed on floors and ceilings. This can be in any format in ZDoom. If the format supports transparency, transparent pixels will be rendered as black (using the palette's darkest color as the black color).