Jump to content

[Vanilla Level Editing] Lesson 5: The Low-Down on Textures


Recommended Posts

USES FOR SOLID TEXTURES ON TWO-SIDED LINES

The treatment of two-sided lines described previously — the lack of vertical repetition of the main texture and the limitations on what those textures may be — is neither as strange nor as restrictive as it may at first appear. As already noted, the textures that are usually applied here — the grids and gratings — you would not normally want tiled.

The only times that you might want to employ a solid graphic as a two-sided main texture is in the creation of secret entrances or sniper ambush spots, as used in the hidden upper passage of id Software’s E1M1. Such locations leave the player open to attack from monsters (or, in Deathmatch play, other players) who cannot be seen and whose presence is only given away when they open fire. These spots are made by placing a solid main texture on one side of a line while leaving the other transparent. The solid texture prevents a player from seeing through the side that carries it, but, from the other side, the line remains transparent. Remember also that the 2-sided flag is more properly termed the 2-sided / see-through / shoot-through flag. Setting it enables players and monsters to shoot through the line’s main texture space without impediment. (Now you see why this creates an ambush spot!)

Remember that a line’s impassability is also determined by a flag. Unless you set this flag, a two-sided line can be passed through — by player or enemies — regardless of the main texture. The “magic” or “secret” entrances that appear in various locations of the main DOOM.WAD — such as the curtains of fire through which a player can walk — are made in this way, too.

In summary: Remember that not all of the available textures can be used to create locations such as the ones just described. If you want a two-sided main texture to look solid, it must consist of either single or side-by-side, non-overlapping patches, and, because it will not be vertically tiled, it also needs to be tall enough to fill the space completely.

Share this post


Link to post

TEXTURE ALIGNMENT

As you have already observed in your own WADs, the game engine’s default application of wall textures does not always result in the desired rendering of the walls. Having had the default mechanism described, you can, no doubt, see why. All is not lost, however, for DOOM provides the designer with a number of controls over the paint-application process, allowing surfaces to be rendered in ways other than by the default painting method.

To demonstrate how these controls work, I shall use two different wall textures: MARBLE2 and BRNSMAL1. The following shows these textures. MARBLE2 is a fairly standard 128 x 128 solid graphic. It is useful here because it has easily identifiable upper and lower edges. BRNSMAL1 is a 64 x 64 see-through texture.

Share this post


Link to post

DEFAULT WALL TEXTURE ALIGNMENT

Consider the application of the MARBLE2 texture to a wall that is taller than 128 units. The texture will be applied from the ceiling down, repeated as necessary until the floor is reached. The texture is 128 pixels tall, so there will be no problem with tutti-frutti. Above and below an opening in the wall, though, something different will happen. The following illustrates the result: The walls on either side of the central opening consist of straightforward single-sided lines. The central opening itself is a two-sided line, with a pitch-black sector beyond it. MARBLE2 is used above and below the opening; the line’s main texture is set to BRNSMAL1. The following shows DOOM’s default rendering of this configuration.



You can see that where the wall is solid, the pattern has been applied from the ceiling down and repeated over the full height of the wall. The upper texture of the two-sided line, however, has been painted upwards from its meeting with the main texture. The main texture itself has been painted from its upper edge but without vertical repetition of the pattern. As a consequence, the grating appears to be suspended from the top of the opening. Beneath the opening, on the line’s lower texture, the marble pattern is applied from the bottom of the main texture down.

Sometimes, this default method of applying the paint achieves the desired effect. Usually though, as here, it spoils the alignment of the upper and lower textures. You probably recognize this effect from your own WADs.

Share this post


Link to post

CHANGING DOOM’S PAINTING METHOD

DOOM provides two mechanisms for changing its wall-painting method. The first is termed unpegging, the second is texture offsetting. I will explain what these terms mean and how they are accessed, before considering how they can be employed.

UNPEGGING

By default, lines are said to have their textures pegged to their surfaces. In other words, the graphical patterns are painted on their surfaces starting from a particular location. These reference locations are the top of the main texture space for the main and upper texture patterns, and at the bottom of the main texture space for the lower. Naturally, this greatly affects the way in which textures align from one wall section to the next. You may recall from the previous room that there are two flags to control a line’s pegging: the upper unpegged flag and the lower unpegged flag. Note that these are linedef attributes; they will therefore affect both sides of a line.

TEXTURE OFFSETTING

A texture offset is a displacement that can be applied to the horizontal and/or vertical position of a texture’s starting point. Using such displacement, you may shift a texture any number of pixels in any direction on any wall. This mechanism provides you with fine control over the graphic’s placement. Again, you may recall from the previous room that each of a line’s two sidedefs supply X- and Y-offset values for texture displacement. These values enable textures to be aligned independently on each side of a line. Note, however, that the offset will be applied to all textures on that side of the line.

Share this post


Link to post

UNPEGGED TEXTURES ON TWO-SIDED LINES

You have seen that, by default, a two-sided line’s upper texture is pegged to its lower edge. By setting the upper unpegged flag, you can unpeg this texture from the structure of the line and have the paint applied from the sector’s ceiling instead. This forces the upper texture to be applied in the same way as it would be on any adjacent single-sided lines, causing their patterns to line up.

Setting a line’s lower unpegged flag will cause the line’s lower texture to lose its pegging to the bottom of the main texture. Again, the unpegged texture’s placement is reckoned from the ceiling, bringing its pattern into alignment with any adjacent single-sided line.

Confusingly, setting the lower unpegged flag will also change the painting of a line’s main texture. Remember that any graphic in this space is normally “hung” from its top and may have transparent space below it. Setting a line’s lower unpegged flag causes this graphic to be placed at the bottom of the main texture space instead. It will still not repeat vertically, so there may now be a transparent area above it. The following shows how the earlier wall-opening is rendered when both upper and lower textures are unpegged.

Share this post


Link to post

UNPEGGING SINGLE-SIDED LINES

It is possible to set the unpegged flags of single-sided lines, even though they have neither upper nor lower textures. The effect is precisely the same as happens to the main texture of a two-sided line when unpegging is used there. Setting the lower unpegged flag will cause the line’s main (and only) texture to be applied from the floor up, rather than from the ceiling down. Changing the upper unpegged flag has no effect on the rendering of single-sided lines.

In the following, the wall to the left of the corner has had its lower unpegged flag set, while the wall to the right uses the default painting method.

Share this post


Link to post

USING TEXTURE OFFSETS

There are occasions when simple unpegging will not achieve the precise alignment effect that a designer wants. Examples would be the small but deliberate misalignment of textures used to give hints of the presence of secret doors; or the adjustment of textures across, rather than up and down, a wall—centering a texture between two adjacent walls, for instance. In cases like these, total control over texture alignment is needed.

To provide this level of control, each sidedef allows the specification of individual X- or Y-offsets. These values may be positive or negative numbers in the range –128 to 127. The X-offset produces a shift of the texture to the left (negative values to the right), while the Y-offset produces a shift upwards (negative values, downward) of the texture, in each case by the specified number of pixels.

Share this post


Link to post

COMBINING UNPEGGING WITH TEXTURE OFFSETTING

The use of these two texture-alignment mechanisms is not mutually exclusive. The graphical engine applies any X- and Y-offset values specified in the sidedefs after all pegging information has been acted upon, so the offset values can always be used to effect small adjustments to the alignment of your textures.

Share this post


Link to post

WAD SORTIE 8: TIDYING UP THE WALLS

With all of the previous information at your fingertips, you should now be able to perform a simple walkthrough of your WAD, noting the alignment problems that exist and deciding on a method for fixing them. Start DOOM and let’s walk through the WAD together.

Share this post


Link to post

FIXING THE FIRST OPENING

The first problem area is around the southwest exit from the hexagonal room. You should now recognize the alignment fault over the opening as a pegging error. The upper textures need to be unpegged on both sides of this opening. Make a note to do this when you next return to the editor.

The second fault with this exit is the alignment of the mortar lines through the gap. Here you have a major problem. Simple realignment of the textures on the short through-wall sections cannot solve the fault, because, as a careful inspection will show you, the mortar lines of the hexagonal room do not line up with those of the southwest room. Now, you could just cheat at this point and apply some kind of neutral texture through the interconnection and hope that no one notices the alignment fault between the two rooms. You wouldn’t learn much by doing that, though, so on this occasion at least, you ought to do things properly!

From the earlier description of the texture-application process, you know that textures are always applied to single-sided lines from the ceiling down. Look at the walls of these two rooms and you will see that this is indeed the case here. The misalignment of textures on each side of the opening is a result of an awkward difference in ceiling height. Now, you could realign all of one room’s textures, but to do this would require the adjustment of the Y-offset of the textures on all of that room’s walls. This would be tedious in the extreme. Fortunately, there is another way out here — why not just change a ceiling height?

The STONE2 and STONE3 textures have four courses of “bricks” up their 128-pixel height. A quick bit of math tells you, then, that the mortar lines of these graphics occur at 32-pixel intervals up each texture. Provided, therefore, you make sure that these two rooms’ ceiling heights differ by an integral multiple of 32, these textures should align automatically.

The current difference is 40, so the problem can be fixed by changing one of the ceiling heights by 8 units. Now, the hexagonal room contains a techno-column that just fits between ceiling and floor and, in addition, has a further sector beyond it, which is fine the way it is. It would therefore make more sense to apply the change to the southwest room’s ceiling, bringing it down 8 units to 152. Make a note of this for your next edit, too.

The same mathematics can be applied to the interconnecting sector, too, of course. Its walls are painted, like all of the rest, down from its ceiling. The current difference between this ceiling height and that of the hexagonal room is 16. That’s 16 pixels short of the 32-unit interval needed to make the textures align properly. Bringing the interconnection’s ceiling down by this amount may make the opening rather low, however. It would be better to apply these 16 units as a Y-offset on the two troublesome lines. Forcing the wall textures down 16 pixels will need a Y-offset of –16. Make another note, then proceed to the next opening, the one out to the courtyard.

Share this post


Link to post

FIXING THE SECOND OPENING

From inside, the next opening looks fine, doesn’t it? Remember, though, that you have just made a note to bring this room’s ceiling height down. This opening will no longer look right, after that fix, so make a note to unpeg this upper texture as well. I suggest that you don’t bother realigning this opening’s through-textures, though; STONE3 looks a bit odd here, anyway. I recommend that you replace both side-walls’ main textures with BROWNHUG. (No, you’re not cheating, just refining the design!)

Moving out into the courtyard now, take a look at the final problem area, the other side of the opening to the courtyard. The misalignment of the upper texture here can again be fixed by unpegging. The lower texture looks okay as it is, to me. It doesn’t align with the textures on either side, but I think that makes it look more like a step, so I vote it stays the way it is.

So, is that everything that needs fixing? It depends on how great a perfectionist you are. The vine texture doesn’t continue perfectly around the bend in the eastern wall, but this is barely noticeable and certainly not worth the effort involved in fixing it. Of course, if you’d like to calculate the X- offsets that need to be applied to two of the vine wall-sections to produce a seamless join, I’ll not stop you. There is one other little change I would make, though, to something you have probably not seen. Press Tab and take a look at the auto-map. Notice how the lines marking off the western and southern walls of your outdoor area show up. I would be inclined to hide these lines by setting their Not on Map flag; that way, the map-watching player is not likely to waste time trying to determine their significance during play.

So, notebook at the ready, try loading GZDB and making a new D2WAD8.WAD, with all of these problems fixed.

Share this post


Link to post

VISUAL MODE

So far I've talked a lot about manual texture alignment and unpegging and doing mental math. This is all well and good, and it's good that you have learned how to do this sort of thing manually. However, I've neglected to expose you to a massive shortcut up to this point. With GZDB open and your map loaded, hover your map over an area you'd like to work on, and press Q.



What the-? This is GZDB's Visual Mode.

In Visual Mode, you are treated to a 3D model of the level you are working on, which can be edited on the fly (to some degree).

While in Visual Mode, you can fly around using ESDF controls (one set to the right of normal WASD). You can look at things and visually determine if they're aligned or not. If not, you can hover over a texture (by looking directly at it) and manually align it, by using the arrow keys.



When you are done, you can press Q again to return to the normal view.

Using normal mode or Visual Mode, go around and practice fixing texture misalignments now. Remember that doing this is never mandatory per se, but it's always appreciated and keeps your hard work from coming across as sloppy.

Share this post


Link to post

ANIMATED TEXTURES

All of the textures you have seen so far have been flat and static, just like paint. But DOOM also provides a family of textures that are rather more exciting than ordinary paint — they are animated.

Share this post


Link to post

USING ANIMATED TEXTURES

After all you have just read about textures, you may be surprised to learn that the use of animated textures is simplicity itself. There are animated textures for walls as well as for floors and ceilings; their names appear in the lists of available textures along with the static ones you are familiar with. You can use them like any other texture. Apply them to the appropriate surface, and the DOOM engine will do the rest.

DOOM performs the animation by cycling around a series of texture names. You specify the entire animation sequence by specifying any name within it. You don’t have to choose a texture from any particular point of the sequence to obtain the complete animation. Note, however, that DOOM steps all animated textures on to their next “frame” at the same time. This means that areas that are given different textures from within the same animation will remain out of phase by the same amount throughout the game.

Share this post


Link to post

SCROLLING TEXTURES

In addition to animated texture sequences, walls can be made to scroll the texture displayed on them horizontally. This is done by setting a line’s special characteristic to a particular value and is thus exclusive to walls. This effect can be applied to any texture, animated or static, on single- or two-sided lines. The setting of a lines special characteristic is the subject of Lesson 7, “Activating Sectors.”

Share this post


Link to post

EXTENDING THE TEXTURE PALETTE

Rich though the id Software-provided texture palette is, there are times when it just seems to lack the precise type of texture you’d like. Often you would like to customize the appearance of your walls, floors, and ceilings to match the scenario of your WAD better. Tools are available to enable you to do this. The techniques involved go beyond simple editing of the map, however, so this topic is deferred.

Share this post


Link to post

EXIT: MOPPING UP AND MOVING ON

In this extensive lesson, you learned more about DOOM’s palette of textures for ceiling, floor, and wall surfaces. You learned how DOOM’s sky works and saw how to add realistic outdoor areas to your map. You learned, too, how the DOOM engine goes about painting its world and precisely what happens if it isn’t provided with all of the textures it needs in order to do it. You saw how to make the game engine paint the walls exactly as you want them by utilizing the alignment mechanisms that are provided. You had a taste of the use of those mechanisms as you fixed all of the remaining problems in your own WAD. Finally, you were told that DOOM’s paint doesn’t need to be static but can be animated.

In the next room, as well as trying out some animated textures, you will start to expand your map with new sectors as you learn the techniques for implementing many of the standard elements of the DOOM world.

You will also receive some of your final lessons in the use of GZDB.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...