Texture: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
(Big old rewrite of several key areas here...)
m (→‎Texture scaling: Space added...)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
:''For information specifically about the TEXTURES lump, which contains texture definitions, see [[TEXTURES]]. For the TEXTURE1 and TEXTURE2 lumps, see [[TEXTUREx]].''
:''For information specifically about the TEXTURES lump, which contains texture definitions, see [[TEXTURES]]. For the TEXTURE1 and TEXTURE2 lumps, 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 [[flat]]s.
Typically, the term '''texture''' refers to a graphic that is displayed on a geometric face in a 3D or fake-3D game. In Doom, specifically, it is a graphic that is displayed on a [[sidedef]], as opposed to the graphics displayed on sector floors and ceilings, which are called [[flat]]s.


==The three types==
==The three types==
Textures may be upper, lower, or middle textures:
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.
* Upper textures are the graphic displayed when a sector's ceiling height on one side of the linedef is higher than the ceiling height of the sector on the other side. 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 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.

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==
==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.
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]]. [[UDMF]] supports this natively, however, rendering the flags for the previously mentioned specials unnecessary.
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]]. [[UDMF]] supports this natively, however, rendering the flags for the previously mentioned specials unnecessary.


==Formats==
==Formats==
===Doom's Original Texture Format===
===Doom's original texture format===
The common texture format used by Doom and most of its [[source port]]s involves creating a list of [[patch]]es 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]].

The common texture format used by Doom and most of its [[source port]]s involves creating a list of [[patch]]es 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 ([[sprite]]s, [[flat]]s, [[patch]]es, 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.


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 the unit yet 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 multiple patches, you still have to create a texture by which that one patch will be used.
ZDoom supports the legacy PNAMES and TEXTUREx formats, but it also has a far more robust texture-definition language known as [[TEXTURES]] which can be used to define textures, flats, sprites, and graphics. It can also apply [[Translation|Translations]], color blends, flips and rotations for patches, and different rendering modes. See the TEXTURES article for more information.


===ZDoom-specific texture formats===
====Texture Scaling====
With ZDoom, these limitations have been remedied. All graphics ([[sprite]]s, [[flat]]s, [[patch]]es, and miscellaneous graphics like [[TITLEPIC]] and [[CONBACK]]) can be used interchangeably.
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 can be specified in a[[TEXTUREx]] (TEXTURE1 and TEXTURE2) lump, but the [[TEXTURES]] language supports this as well. Images scaled in either method are scaled globally. Any time the scaled images are used, they will appear at that scale. However, with the use of [[Line_SetIdentification]] and [[Line_SetTextureScale]], or the equivalent native scaling capabilities of UDMF, textures can be scaled on a per-usage basis. Doom Builder 2 can show this scaling in it's visual editing mode.


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 any supported [[image 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.
=====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.


ZDoom supports the legacy PNAMES and TEXTUREx formats, but it also has a far more robust texture-definition language known as [[TEXTURES]] which can be used to define textures, flats, sprites, and graphics. It can also apply [[translation]]s, color blends, flips and rotations for patches, and different rendering modes. See the TEXTURES article for more information.
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.


====Texture scaling====
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.
ZDoom supports scaling of textures in order to fit what would be a smaller or larger texture in to 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. High-resolution textures composed of a single image can be placed between [[HI_START]] and [[HI_END]] markers if they replace an existing low-resolution texture (no matter how the latter is defined). The engine will automatically scale the hi-res image to the dimension of the original one. Texture scale can also be directly specified in a [[TEXTUREx]] (TEXTURE1 and TEXTURE2) lump thanks to a ZDoom-specific extension of the specifications, though the [[TEXTURES]] lump supports this as well in a simpler and less limited way.


Images scaled with any of these methods are scaled globally. Any time the scaled images are used, they will appear at that scale. However, with the use of [[Line_SetIdentification]] and [[Line_SetTextureScale]], or the equivalent native scaling capabilities of UDMF, textures can be scaled on a per-usage basis. Doom Builder 2 can show this scaling in its visual editing mode.
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.


=====Alignment issue=====
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.
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. A modern editor which supports ZDoom features, such as Doom Builder 2, will handle it automatically.


====Texture animation====
To achieve this effect when using TEXTURES, the WorldPanning keyword can be added outside of the patch block. See the TEXTURES article for more information.
ZDoom supports the [[ANIMATED]] and [[SWITCHES]] lumps from [[Boom]] for animations and switches, respectively, but you are encouraged to use instead the [[ANIMDEFS]] language which is simpler to use and allows for far more flexible and robust editing, such as defining menu cursors, sounds on switches, and graphic warping.


====Texture Animation====
ZDoom supports [[Boom|Boom's]] [[ANIMATED]] lump for animations and switches, but you are encouraged to use it's own [[ANIMDEFS]] language which allows for far more robust editing, such as defining menu cursors, sounds on switches, graphic warping, and so on.
[[Category:Glossary]]
[[Category:Glossary]]

Latest revision as of 08:41, 12 May 2023

For information specifically about the TEXTURES lump, which contains texture definitions, see TEXTURES. For the TEXTURE1 and TEXTURE2 lumps, 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, specifically, it is a graphic that is displayed on a sidedef, as opposed to the graphics displayed on sector floors and ceilings, which are called flats.

The three types

Textures may be upper, lower, or middle textures:

  • Upper textures are the graphic displayed when a sector's ceiling height on one side of the linedef is higher than the ceiling height of the sector on the other side. 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. UDMF supports this natively, however, rendering the flags for the previously mentioned specials unnecessary.

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 the unit yet 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 multiple patches, you still have to create a texture by which that one patch will be used.

ZDoom-specific texture formats

With ZDoom, these limitations have been 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 any supported image 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.

ZDoom supports the legacy PNAMES and TEXTUREx formats, but it also has a far more robust texture-definition language known as TEXTURES which can be used to define textures, flats, sprites, and graphics. It can also apply translations, color blends, flips and rotations for patches, and different rendering modes. See the TEXTURES article for more information.

Texture scaling

ZDoom supports scaling of textures in order to fit what would be a smaller or larger texture in to 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. High-resolution textures composed of a single image can be placed between HI_START and HI_END markers if they replace an existing low-resolution texture (no matter how the latter is defined). The engine will automatically scale the hi-res image to the dimension of the original one. Texture scale can also be directly specified in a TEXTUREx (TEXTURE1 and TEXTURE2) lump thanks to a ZDoom-specific extension of the specifications, though the TEXTURES lump supports this as well in a simpler and less limited way.

Images scaled with any of these methods are scaled globally. Any time the scaled images are used, they will appear at that scale. However, with the use of Line_SetIdentification and Line_SetTextureScale, or the equivalent native scaling capabilities of UDMF, textures can be scaled on a per-usage basis. Doom Builder 2 can show this scaling in its visual editing mode.

Alignment issue

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. A modern editor which supports ZDoom features, such as Doom Builder 2, will handle it automatically.

Texture animation

ZDoom supports the ANIMATED and SWITCHES lumps from Boom for animations and switches, respectively, but you are encouraged to use instead the ANIMDEFS language which is simpler to use and allows for far more flexible and robust editing, such as defining menu cursors, sounds on switches, and graphic warping.