home *** CD-ROM | disk | FTP | other *** search
/ WADS of WADS / WadsOfWads.1994.zip / TEXT / TEXTURES.TXT < prev    next >
Text File  |  1994-06-15  |  20KB  |  438 lines

  1.     MANAGING TEXTURES AND THE "UNPEGGED" ATTRIBUTE
  2.     ----------------------------------------------
  3.  
  4.         Scott Amspoker   (scott@basis.com)
  5.  
  6. There have been recurring questions regarding the use of "pegged" and
  7. "unpegged" textures on walls as well as the tile rendering of textures 
  8. by the Doom engine.  This is not just a beginner's problem.  Even the 
  9. more sophisticated and popular PWADs submitted by netters have the 
  10. occasional texturing oversight.  Here is an explanation of how textures 
  11. are rendered by Doom.  The bulk of the following text deals with wall
  12. textures in particular.
  13.  
  14. As you have already discovered, every section of wall in Doom has three 
  15. rectangular areas that must be filled in by the Doom engine - the 
  16. upper texture, the normal texture, and the lower texture.  Each area may
  17. have a different texture map assigned to it or no texture at all
  18. inidicated by a texture name of "-".  Any given wall can have all three
  19. areas exposed to the player but most walls will have one of more of these
  20. areas out of view.  When choosing texture maps, the PWAD creator must 
  21. consider how Doom will use that texture map to fill in the rectangular wall 
  22. areas and understand how Doom's default behaviour can be changed via the 
  23. "unpegged" attributes.
  24.  
  25. Doom fills in each wall area by tiling its texture map horizontally
  26. and vertically until the entire area is covered.  The texture map
  27. may be truncated horizontally and/or vertically if the wall area
  28. dimensions are not an even multiple of the dimensions of the texture
  29. map.
  30.  
  31. In all cases, texture maps are placed on the horizonal axis beginning
  32. with the left edge of the wall and working towards the right.  The
  33. placement of textures on the vertical axis is more complicated and differs 
  34. depending on various conditions described below.
  35.  
  36. Some of the texture maps found in the standard DOOM.WAD file are have
  37. a homogeneous quality to them.  The effects of tiling/truncating
  38. them are not visible and the PWAD designer need not worry about
  39. unusual wall dimensions.
  40.  
  41. On the other hand, some texture maps have distinct markings that won't
  42. appear correct when tiled/truncated without some intervention by the
  43. PWAD designer.  It is desirable that the texture maps of adjoining
  44. wall segments line up with each other to create a seamless composite
  45. wall.  Sometimes, deliberate texture mis-alignment is used as a hint
  46. to the player of a secret door.  NOTE: some texture maps that
  47. have a height other than 64 or 128 (such as a stair riser) do not
  48. appear to tile very well.  For some reason you might end up with
  49. small pink cracks in the wall texture.  While this can have a really
  50. cool effect, treat it as a bug.
  51.  
  52. Most texture maps found in the standard WAD are 128 units high.  For
  53. most of the following examples, I will use the following texture map:
  54.  
  55.        --------------------
  56.       |TTTTTTTTTTTTTTTTTTTT|
  57.       |                    |
  58.       |                    |
  59.       |                    |
  60.       |                    |
  61.       |                    |
  62.       |                    |
  63.       |                    |
  64.       |                    |
  65.       |BBBBBBBBBBBBBBBBBBBB|
  66.        --------------------
  67.  
  68. For reference, I've labeled the top of the map with T's and the bottom with 
  69. B's.
  70.  
  71.  
  72. THE NORMAL TEXTURE
  73. ------------------
  74.  
  75. Single-sided linedefs only require that the normal texture be defined.  In
  76. this case the normal texture is the entire area of wall you see from floor 
  77. to ceiling.  By default, Doom will fill the normal texture with the assigned 
  78. texture map starting with the top and working down.  If the wall is
  79. somewhat taller than the texture map, it will look like this:
  80.  
  81.        --------------------
  82.       |TTTTTTTTTTTTTTTTTTTT|
  83.       |                    |
  84.       |                    |
  85.       |                    |
  86.       |                    |
  87.       |                    |
  88.       |                    |
  89.       |                    |
  90.       |                    |
  91.       |BBBBBBBBBBBBBBBBBBBB|
  92.       |TTTTTTTTTTTTTTTTTTTT|
  93.       |                    |
  94.       |                    |
  95.        --------------------
  96.  
  97. If the wall is shorter than the texture, the result would be:
  98.  
  99.        --------------------
  100.       |TTTTTTTTTTTTTTTTTTTT|
  101.       |                    |
  102.       |                    |
  103.       |                    |
  104.       |                    |
  105.        --------------------
  106.  
  107. Notice that the top of the texture is always at the top of the wall.
  108. The texture is rendered working down the wall towards the floor and
  109. repeated if necessary.
  110.  
  111. By setting the "lower unpegged" bit in the linedef, the rendering of the
  112. normal texture will be performed from the bottom up instead of the top
  113. down.  (The "lower unpegged" bit is normally associated with the lower
  114. texture but also has an effect on the normal texture.)  Our tall wall 
  115. would now look like this:
  116.  
  117.        --------------------
  118.       |                    |
  119.       |                    |
  120.       |BBBBBBBBBBBBBBBBBBBB|
  121.       |TTTTTTTTTTTTTTTTTTTT|
  122.       |                    |
  123.       |                    |
  124.       |                    |
  125.       |                    |
  126.       |                    |
  127.       |                    |
  128.       |                    |
  129.       |                    |
  130.       |BBBBBBBBBBBBBBBBBBBB|
  131.        --------------------
  132.  
  133. Our short wall would be:
  134.  
  135.        --------------------
  136.       |                    |
  137.       |                    |
  138.       |                    |
  139.       |                    |
  140.       |BBBBBBBBBBBBBBBBBBBB|
  141.        --------------------
  142.  
  143. Notice that the bottom of the texture map begins at the bottom of the wall
  144. and works up.
  145.  
  146.  
  147. THE UPPER AND LOWER TEXTURES
  148. ----------------------------
  149.  
  150. A linedef may have sectors on both sides of the line. In such a case, both 
  151. sides of the linedef have wall definitions (sidedefs).  If the "2-sided"
  152. attribute is set then Doom considers each of the two sectors to
  153. be exposed to the other sector.  When a 2-sided line is used, the PWAD 
  154. designer must always consider what they player should see when facing the 
  155. line from both sides.  A 2-sided line is most often used as a see-through 
  156. connection between two sectors (such doorways, windows, stairs, and
  157. platforms).  Therefore, the normal texture on both sides would typically 
  158. be invisible ("-").  However, since the two sectors could have different
  159. floor and ceiling heights, the dimensions of wall space on either side
  160. of the line could be different.  The "upper texture" is used to handle
  161. the difference (if any) between adjacent ceilings.  The "lower texture"
  162. is similarly used to handle the different floor elevations (if any).
  163.  
  164. In a nutshell, the normal texture is the area of wall that both sectors
  165. have in common.  This would be the portion of the wall above the higher 
  166. of the two floors and below the lower of the two ceilings.  (Both sides of 
  167. the line will normal textures.)  The upper texture is the area of the
  168. wall between the two ceiling heights.  This area is visible only
  169. on the side of the line with the higher ceiling.  The lower texture
  170. is the wall space between the two floor heights and is only visible
  171. on the side with the lower floor.
  172.  
  173. NOTE: If the ceiling texture of both sectors is F_SKY1 then the upper
  174. texture between them will also be invisible regardless of its assigned 
  175. texture map.  See the courtyard in E1M1 for an example of this.
  176.  
  177.  
  178. By default, the upper texture is tiled from the bottom up and the lower
  179. texture is tiled from the top down.
  180.  
  181. Consider a window.  The area above the window opening is the upper texture.
  182. The window opening itself is the normal texture.  The area below the
  183. window opening is the lower texture.  Let's use the following wall
  184. segment with our example texture map assigned to upper and lower areas:
  185.  
  186.        --------------------
  187.       |                    |
  188.       |                    |   <- upper texture
  189.       |BBBBBBBBBBBBBBBBBBBB|
  190.       |--------------------|
  191.       |                    |   <- normal texture ("-")
  192.       |                    |
  193.       |--------------------|
  194.       |TTTTTTTTTTTTTTTTTTTT|
  195.       |                    |   <- lower texture
  196.       |                    |
  197.        --------------------
  198.  
  199. Notice how the bottom of the texture map rests on the bottom of the
  200. upper area whereas the lower area is just the opposite.  If this wall
  201. section were placed adjacent to a regular wall panel, the texture
  202. pattern would not line up:
  203.  
  204.       --------------- --------------------
  205.      |TTTTTTTTTTTTTTT|                    |
  206.      |               |                    |
  207.      |               |BBBBBBBBBBBBBBBBBBBB|
  208.      |               |--------------------|
  209.      |               |                    |
  210.      |               |                    |
  211.      |               |--------------------|
  212.      |               |TTTTTTTTTTTTTTTTTTTT|
  213.      |               |                    |
  214.      |BBBBBBBBBBBBBBB|                    |
  215.       --------------- --------------------
  216.  
  217.  
  218. By setting the "upper unpegged" attribute, the upper texture is rendered
  219. from the top down similar to a normal texture:
  220.  
  221.       --------------- --------------------
  222.      |TTTTTTTTTTTTTTT|TTTTTTTTTTTTTTTTTTTT|
  223.      |               |                    |
  224.      |               |                    |
  225.      |               |--------------------|
  226.      |               |                    |
  227.      |               |                    |
  228.      |               |--------------------|
  229.      |               |TTTTTTTTTTTTTTTTTTTT|
  230.      |               |                    |
  231.      |BBBBBBBBBBBBBBB|                    |
  232.       --------------- --------------------
  233.  
  234. Likewise, by setting the "lower unpegged" attribute, the lower texture 
  235. will appear rendered from the bottom up:
  236.  
  237.       --------------- --------------------
  238.      |TTTTTTTTTTTTTTT|TTTTTTTTTTTTTTTTTTTT|
  239.      |               |                    |
  240.      |               |                    |
  241.      |               |--------------------|
  242.      |               |                    |
  243.      |               |                    |
  244.      |               |--------------------|
  245.      |               |                    |
  246.      |               |                    |
  247.      |BBBBBBBBBBBBBBB|BBBBBBBBBBBBBBBBBBBB|
  248.       --------------- --------------------
  249.  
  250. Actually, an unpegged lower texture is a tad more complicated than this.
  251. The bottom starting point on the texture map is not necessarily the
  252. bottom of the map.  Instead, Doom choses the starting point based on
  253. the distance between the ceiling and the floor.  The end result is that
  254. the bottom of the lower texture will line up with the bottom of the
  255. adjacent wall.  If the above example were shorter, both wall sections
  256. would still align:
  257.  
  258.       --------------- --------------------
  259.      |TTTTTTTTTTTTTTT|TTTTTTTTTTTTTTTTTTTT|
  260.      |               |                    |
  261.      |               |                    |
  262.      |               |--------------------|
  263.      |               |                    |
  264.      |               |                    |
  265.      |               |--------------------|
  266.      |               |                    |  <- bottom row cut off both walls
  267.       --------------- --------------------
  268.  
  269. As you can see, unpegged upper and lower textures are used for seamless
  270. windows.
  271.  
  272. NOTE: As mentioned earlier, the effect of "lower unpegged" on normal textures
  273. really does cause a bottom-up rendering of the texture.  If the "lower 
  274. unpegged" attribute were set for the adjacent wall in the above example,
  275. it would look like this:
  276.  
  277.       --------------- --------------------
  278.      |               |TTTTTTTTTTTTTTTTTTTT|
  279.      |               |                    |
  280.      |               |                    |
  281.      |               |--------------------|
  282.      |               |                    |
  283.      |               |                    |
  284.      |               |--------------------|
  285.      |BBBBBBBBBBBBBBB|                    |  <- bottom rows don't match
  286.       --------------- --------------------
  287.  
  288.  
  289. APPLICATIONS OF UNPEGGED ATTRIBUTES
  290. -----------------------------------
  291.  
  292. The following are common situations where an understanding of pegged vs.
  293. unpegged textures is important:
  294.  
  295. Windows and fixed doorways:
  296.     As shown in the above example, use unpegged upper and lower textures
  297.     to ensure alignment with surrounding wall sections.
  298.  
  299.  
  300. Doors:
  301.    Doors are usually implemented as a sector where the ceiling height 
  302.    is the same as the floor height.  The player will normally see only 
  303.    the upper texture which will contain the image of the door.  When the 
  304.    door "opens", the ceiling of the door sector rises.  The default 
  305.    pegged mode is used to let the door image rise with the ceiling since 
  306.    the upper texture is based at the bottom edge of the rising ceiling.
  307.  
  308.    The walls making up the inside tracks of the door are defined as
  309.    normal textures since they are going to be on single-sided lines.
  310.    Since normal textures are rendered from the ceiling down, the
  311.    inside tracks will rise as the door (ceiling) rises.  This is usually 
  312.    not the desired behaviour.  By setting the "lower unpegged" bit
  313.    for the inside tracks, they will remain stationary while the
  314.    door opens since they will be based on the non-changing floor.
  315.  
  316.    The rising hallway on the other side of the acid pit in E1M3
  317.    is a classic example of the side walls remaining pegged so that
  318.    they rise with the ceiling.
  319.  
  320.  
  321. Secret doors:
  322.     Secret doors behave the same way as regular doors but add a little
  323.     more complexity to texture decisions if the door is to blend in
  324.     with the surrounding wall.  Normally the door is closed
  325.     so that the player only sees the upper texture from floor to
  326.     ceiling.  Since the upper texture is rendered from the bottom
  327.     up, the bottom of the door (where it meets the floor) will
  328.     show the bottom of the texture map.  If the room has a non-standard
  329.     ceiling clearance, the adjacent wall panel won't meet the floor
  330.     the same way as the closed door.  Rather than make the door
  331.     match the adjacent walls, you can make the adjacent walls match
  332.     the door by unpegging their lower texures (which re-aligns
  333.     the normal textures) so that everybody builds from the floor up.
  334.  
  335.     The "secret" attribute may be set so that the door doesn't show
  336.     up on the map.  However, this will only work if the floor/ceiling 
  337.     height of the closed door sector is less than or equal to the floor
  338.     height of the room sector.  In other words, if the doorway is a 
  339.     step up from the room, the map will give away the secret by showing
  340.     the lines immediately beyond the door even before the door is first
  341.     opened.
  342.  
  343.  
  344. Switches and other wall decorations:
  345.     The standard textures containing wall switches are 128 units high.
  346.     (This also includes decorations such as "POISON" signs and
  347.     gargoyles).  When using these textures on a wall that is shorter, the 
  348.     switch will move down towards the floor since the normal wall 
  349.     texture is rendered from the ceiling down.  To keep the switch at 
  350.     a reasonable height on the wall, set the "lower unpegged" bit.
  351.     The wall will build up from the floor and the switch will always
  352.     be at a proper height regardless of where the ceiling is.
  353.  
  354.  
  355.  
  356. MANUAL ADJUSTMENT OF TEXTURE OFFSETS
  357. ------------------------------------
  358.  
  359.     There are situations where manipulation of the "unpegged" bits
  360.     will fail to create the desired alignment of wall sections.
  361.     Since the "unpegged" bits only affect the vertical rendering
  362.     of texture maps, they will not help when a horizontal adjustment
  363.     is needed.  Horizontal adjustments might be necessary when wall
  364.     sections with non-standard widths are combined to create a 
  365.     single wall.  If the texture map style creates a noticable seam,
  366.     then you may adjust the horizontal and vertical offsets for 
  367.     each wall segment.  The "X offset" parameter tells Doom how
  368.     far horizontally into the texture map to begin rendering.  A positive
  369.     value would appear to shift the texture to the left.  Likewise,
  370.     the "Y offset" specifies how far vertically (from the top) to
  371.     begin rendering.  A positive value would appear to shift the
  372.     texture upward.  All three textures (upper, lower, and normal)
  373.     are affected by these values.
  374.  
  375.     At first glance it might appear that these offets are troublesome
  376.     to determine.  In actual practice, it is usually easy to determine
  377.     offsets for any given situation.
  378.  
  379.     Y offsets are the most common since they are necessary to make things 
  380.     appear aligned horizontally (by shifting a texture up and down,
  381.     you affect the alignment of horizontal features).  Generally,
  382.     there are 3 values to consider when setting the Y offset:
  383.  
  384.          1) The ceiling height of the current sector.
  385.      2) The ceiling height of a relevant adjoining sector.
  386.      3) The height of the texture map.
  387.  
  388.     Normally, the desired Y offset will turn out to be the difference
  389.     between any 2 of these values.  It is also useful to remember that
  390.     an offset can be negative.  For example instead of an offset of 100
  391.     into a 128-unit texture, an offset of -28 will do the same thing.
  392.     (There's also a good chance that the "28" was easier to determine from
  393.     the circumstances.)
  394.  
  395.     The X offset is less common and is most often used to center textures
  396.     on wall segments that are not the same width as the texture.  This
  397.     happens when creating narrow doorways or placing switches and other
  398.     decorations on short wall segments.  In such cases, simply subtract
  399.     the wall length from the texture length and set the X offset to
  400.     half that value.
  401.  
  402.     A less common situation is when textures for several contiguous wall 
  403.     segments must appear as one wall.  Most Doom textures would still appear 
  404.     just fine in such situations if the X offset were ignored.  However,
  405.     a few textures (such as computer panels) would look sloppy without
  406.     carefully setting the X offsets.  In such cases, the X offset for
  407.     a wall would be the sum of the X offset and length of the preceeding
  408.     wall (to the left).  If the offset gets too large then wrap it around
  409.     to the negative and continue.
  410.  
  411.  
  412. FLOORS AND CEILINGS
  413. -------------------
  414.  
  415. The textures used for floors and ceilings are all 64 x 64 units.  Unlike
  416. wall textures, floor and ceiling textures are aligned and oriented with 
  417. respect to the underlying map coordinate grid.  Since these textures
  418. are tiled globally, they will always create seamless transitions from
  419. one sector to the next (assuming the adjoining sector has similar
  420. floor/ceiling textures).
  421.  
  422. Some floor/ceiling textures have specific markings on them that are
  423. important.  For example, some ceiling textures have a grid of lights.
  424. To ensure that the ceiling lights in a sector tile correctly, not only
  425. must the sector size be a proper multiple of a single light, but the
  426. sector itself must be placed on the map at an appropriate grid line.
  427.  
  428. A transporter pad has a special design.  In order for the image
  429. on the transporter pad to appear correct, the pad must be aligned on
  430. a 64 x 64 map grid.
  431.  
  432. There are some special stair step textures (STEP1 and STEP2).  These could 
  433. be used for the top surface of each stair.  If you wish to use these textures 
  434. for your stairs, make sure you pick the texure with the proper north/south or
  435. east/west orientation and snap your stairs to a 64-unit width and a
  436. 32-unit depth.
  437.  
  438.