Custom textures tutorial - SLADE
|This article or section should contain one or more images. Please spruce up the article by adding an image.|
There are two ways of creating textures in SRB2: One way is to simply import the image that you want to use as a texture into the WAD file and convert it to Doom's graphics format. To make the game recognize these single-image textures, they must be stored between two marker lumps,
While this method can generally be used for all textures, it is sometimes useful to combine a texture out of several images, for example if it has repeating patterns or if it shares parts with another texture. Textures that are combined out of several images are called composite textures, and they can be defined in a special text lump called
TEXTURES. The individual images in a composite texture are called patches. You can either use already existing single-image textures as patches or put additional patches between the marker lumps
P_END. Patches between
P_END cannot be used as stand-alone textures.
Like single-image textures, flats are simply imported into the WAD files as images, but they are stored in a different graphics format. Flats should be put between
F_END marker lumps.
To prevent conflicts, never use a name for a composite texture that is already in use as a patch or a flat. Likewise, never use a name for a patch, texture or flat that is already used in SRB2 or your own WAD, unless you want to replace an already existing patch/texture/flat.
To use an image as a texture, its width needs to be a power of 2 (such as 32, 64, 128 and so forth). The height can be anything. Before you start importing your textures, you need to add the
TX_START marker. To do this, click Archive → New → Entry in the menu bar and type in
TX_START as the name. You should now see a new lump with the file type "Marker".
Now you can import the images. Click Archive → Import Files in the menu bar, browse to the folder where your images are located, select them and hit enter. The name of a lump must have eight characters or fewer and should be uppercase, so rename the lumps if necessary by right-clicking on them and selecting Rename. Now select all imported lumps at once, right-click on them, and select Gfx → Convert to... The conversion window will pop up. Select "Doom Gfx (Paletted)" as the format to convert to and make sure SRB2's palette (which should be "Existing/Global" if you have set up
srb2.srb as your Base Resource, otherwise use "Sonic (SRB2)") is selected. Press Convert to convert the images. Now add the
TX_END marker just like the
TX_START marker above to close off the texture section. Now you can use the textures in your map.
Skies are created just like any other texture. However, to use them as a sky, name the texture
SKYx, with x being the integer number you want. You can then use the sky for your levels by referencing the sky number in the level headers, using the
Unlike textures, images that are used for flats must be exactly square. Their height and width must also be one of the following: 32, 64, 128, 256, 512, 1024 or 2048. Importing the flats works just like with textures above, except that the marker lumps are called
F_END, and that you need to convert the images to "Doom Flat (Paletted)" instead of "Doom Gfx (Paletted)".
If you want to import additional patches for your composite textures that cannot be used as stand-alone textures, import them just like the single-image textures above, but put them between
P_END marker lumps.
To create new composite textures, open SLADE's texture editor by clicking Archive → Texture Editor in the menu bar. If no
TEXTURES lump already exists in your WAD file, SLADE will ask you if it should create one for you. Click yes and select "ZDoom (TEXTURES)" and "Create New (Empty)" in the window that now opens. Now a new lump called
TEXTURES should appear. Double-click that lump to open the texture editor. The texture editor provides a simple interface for creating composite textures out of your patches. To the left is a list of all composite textures. If you click on a texture, it will be displayed in the center of the window.
For the purposes of this tutorial, we will create a texture out of patches that are already included with SRB2. To create a new texture, click the "New" button below the list of textures and enter
MARIOVIN as the name. Now an empty 64×128 texture frame will appear in the center of the window. At the bottom of the screen is a panel where you can edit various properties of the texture. Most of these have no effect in SRB2, but you can set the name and the size of the texture here. Increase the size to 128×128. Also, you must always set the type to "WallTexture" for SRB2 to recognize the texture.
To the right of the screen is a list of patches that are included in the texture. Right now the field is empty. Click the "Add new patch to texture" button to open the graphics browser. Note that the patches are separated from the stand-alone textures here. Go into the textures selection and search for
MARIOW1 (there is a search box in the top right corner). Select this texture to add it to your composite texture. You will see that the previously empty texture frame is now filled up by the selected texture.
Now we will add vines on top of the texture. Open the graphics browser again and go into the patch selection. Search for
VINE2 and add it to the texture. You will see that it is laid on top of the
MARIOW1 patch, but since it is only 64×64 pixels big, it only fills up the top-left quarter of it. To fill up the rest of the texture, you must create three duplicates of the
VINE2 patch by clicking the "Duplicate selected patch(es)" button next to the patch list.
Now, click on the first duplicate and look at the panel below the patch list. Again, most of the properties you can set here have no effect, but can change the position of the patch on the texture here. Change the X position of the first duplicate to 64 and its Y position to 0. You can also position the patch by dragging it around in the preview. Move the other two duplicates to positions (0,64) and (64,64), respectively. Now the entire texture is covered with vines. Click "Save" above the texture list to save your new composite texture.
Animated textures and flats
Animated textures and flats are textures/flats that cycle through several images at a specified interval to create an animation effect. They are defined in a special text lump called
ANIMDEFS. Every line of text in this lump defines one animated texture or flat and has the following format:
Texture/Flat [Texture name] Range [Texture name] Tics [Integer]
Texture/Flat [Texture name]: Determines the texture/flat at which the animation loop starts. Use the keyword
Texturefor animated textures and the keyword
Flatfor animated flats.
Range [Texture name]: Determines the texture/flat at which the animation loop ends. All textures/flats that are between those two alphabetically will also be included in the loop, e.g. if the first texture is
SAMPLE1and the last is
SAMPLE4, then SRB2 will cycle through the textures
SAMPLE4for that animated texture. It is generally a good idea to number textures/flats that are part of an animation loop consecutively like this, to make sure the right images are included in the loop.
Tics [Integer]: Determines how long each individual texture/flat will be displayed before changing to the next, in tics.
ANIMDEFS lumps that were automatically converted from the
ANIMATED format (which SRB2 used before v2.1) with SLADE will have the keyword
Texture/Flat and the name of the first texture. This keyword has no effect in SRB2 and can be omitted.
Flat LITEY1 Range LITEY3 Tics 4 Texture GFALL1 Range GFALL4 Tics 2
The first line defines an animated flat that cycles from
LITEY3, changing images every four tics. The second line defines an animated texture that cycles from
GFALL4, changing images every two tics.