Texture
From ZDoom Wiki
- For information specifically about the TEXTUREx lump, which contains texture definitions, see TEXTUREx.
Typically, the term texture refers to a graphic that is displayed on a geometric face in a 3d or fake 3d game. In Doom, it is specifically a graphic that is displayed on a sidedef, as opposed to the graphics displayed on sector floors and ceilings, which are called flats.
Contents |
The three types
Textures may be upper, lower, or middle textures. Upper textures are the graphic displayed when the sector height on the side we, the viewer, are nearest to, is higher than the sector height on the other side of the line we are looking at. An example of this is the wall above a doorframe.
A lower texture can be best explained by comparing it to the front of a step on a set of stairs, the vertical face of the step.
A middle texture is what is displayed on either the space between two sectors, below the upper texture and above the lower texture, or on a one-sided impassable wall.
Tiling behavior
Upper and lower textures will tile horizontally and vertically, and should do so without any notable anomalies or discrepancies. Middle textures, though, tile differently based on the number of sidedefs on the linedef in question. If the line has only one sidedef -- the usual flat, impassable wall -- the texture will tile horizontally and vertically. However, if the line has two sidedefs -- a sector on both sides of the line (even if they are the same sector) -- the texture will only tile horizontally. This is often used to achieve things like the "crossbeam" effect or to make simple fences.
If you would like a 2-sided line to tile vertically, you may use the extra flags (specifically, flag 16) available to the action special Line_SetIdentification or TranslucentLine.
Formats
Doom's Original Texture Format
The common texture format used by Doom and most of its source ports involves creating a list of patches from applicable graphical resources to be used as parts of textures, and then arranging selected patches in a user-defined window of sorts. A texture consists of several pieces of information: The height and width of the texture, a list of patches used on the texture, and the offset information for each patch used. The list of patches usable for Doom-format textures is contained in the PNAMES lump, while individual textures are defined in TEXTUREx.
Good examples of the benefit of this format are switches and monitors seen in Doom maps. The switch graphic is a patch laid over a normal wall texture, and yet the unit exists as a single texture. A drawback of this method of defining textures is the need for a texture to contain at least one patch. For example, if you have a simple texture consisting of a single graphic and do not need to overlay multiple parts in order to save filesize by making redundant graphical components into patches to be used in multi-patch textures, you still have to create a texture for that one patch to be used by.
ZDoom-Specific Texture Formatting
Since ZDoom version 2.0.48, though, these limitations have been somewhat remedied. All graphics (sprites, flats, patches, and miscellaneous graphics like TITLEPIC and CONBACK can be used interchangeably.
Placing lumps between TX_START and TX_END will immediately designate entries as graphics that can be used on walls, floors, and ceilings. These textures may be in either 256 color bitmap or 8-bit palette-indexed PNG format. Using TX_START and TX_END to designate textures is not without its drawbacks, however. It does not currently provide any means of specifying texture scale or multiple patches and offsets, so scaled textures and multi-patch textures cannot be accommodated by this format.
Texture composition and redefinition can be made in the TEXTURES lump.
Texture Scaling
ZDoom supports scaling of textures in order to fit what would be a smaller or larger texture into a smaller or larger space. This can be used to achieve a high-resolution texture effect by making a larger texture fit in a smaller area or to stretch a smaller texture over a greater area. Texture scale is specified in the TEXTUREx (TEXTURE1 and TEXTURE2) lump. This means that texture scaling is global; Resource editors such as DeePsea and XWE can make the necessary changes in the TEXTUREx lump, but map editors such as Doom Builder cannot scale textures on a per-usage basis. See TEXTUREx for details about texture scaling.
An Alignment Issue with Scaled Textures
When a texture is scaled, the way it is aligned is affected. If the texture is scaled to be half-size, the offset (in the map editor, not the texture definition) for that texture must be doubled in order to achieve desired results. If the texture is quarter-size, the offset must be quadrupled, and so on.
To make things easier, however, there's a solution to this. If you would like your scaled textures to be aligned using map units, you can set a certain flag in your TEXTUREx lump. That flag is 0x8000.
To do this in XWE, open your TEXTUREx lump in XWE. Notice the column that says "Flags". All textures have this defaulted to $0000. You would then click your high-res texture which you want to be aligned in map units and modify this field from $0000 to $8000. Be sure to save your changes by going to the menubar and choosing Textures -> Save. Voila! High res textures are now aligned with map units. If you are using DoomBuilder, you can even use the 3-d mode's auto-align feature and it would align properly.
In DeePsea there is a "world units" check box. This can be found in the main texture editor screen and the individual texture editing screen. In the main screen, highlight the texture name you want to set the flag for and check the "world units" box. This will set the flag for the highlighted texture. In the individual texture editing screen, the "world units" check box sets the flag for the texture currently being edited.
Once a hi-res texture is set up in DeePsea, DeePsea knows about it. Pressing the X and Y alignment hotkeys will therefore correctly align hi-res textures including taking account of the type of offset the texture uses.
Texture Animation
ZDoom's ANIMDEFS and ANIMATED lumps allow you to define animation sequences including not only graphics but sound as well, graphic warping such as Quake did with its fluid textures, and more. See ANIMDEFS and ANIMATED for more information.

