Custom textures tutorial - XWE

From SRB2 Wiki
Jump to: navigation, search
Warning icon.png
This article or section should contain one or more images. Please spruce up the article by adding an image.

This tutorial will teach you how to create custom textures and flats in SRB2 using XWE as a lump editor.

Contents

Introduction

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, TX_START and TX_END.

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_START and P_END. Patches between P_START and 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_START and 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.

Palette setup

In order to import your images into the WAD, you need to set up XWE to use SRB2's palette. If you don't do this, the images will be converted into the standard Doom palette, which is different from SRB2's palette, and their colors will be messed up as a result. This article explains how to set up the palette in XWE.

Single-image textures

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 Entry → New 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 Entry → Load 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 Entry. XWE will automatically convert the images into the Doom Graphics Format. 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

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 SkyNum parameter.

Flats

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, 1024 or 2048. Importing the flats works just like with textures above, except that the marker lumps are called F_START and F_END, and that you need to convert the images to the Doom Flat Format. To do this, select each image individually and click Image → Save as Doom Flat in the menu bar.

Note: Flats that have a height and width of 256 will look like they are corrupt when you reload the WAD, but they are not. You will still be able to use them in SRB2.

Composite textures

Test.png This article or section is outdated and has not been updated to reflect the release of 2.1.

Please help the Wiki by correcting or removing any misinformation, as well as adding any new information to the page.

If you want to make a texture that consists of multiple patches, you have to add those patches to PNAMES. Select all relevant patches, right-click on them and select Add to Patch Names. Now click on the TEXTUREx lump to open the texture editor. The texture editor provides a simple interface for creating textures out of your patches. In the top part of the editor, you will see two tables. The left table lists the textures in the WAD, along with information on each texture such as their height and width. Ignore the fields for X and Y scale, which have no effect in SRB2. Selecting a texture in the table will display it in the bottom part of the window. The table to the right lists all patches that are included in the texture, along with information on each patch, such as their name and position on the texture. The PID is the index number of the patch in the PNAMES lump, while the UID is used to identify which patches belong to which texture.

For the purposes of this tutorial, we will create a texture out of patches that are already in SRB2. Press the Insert button on your keyboard or select Textures → New in the menu bar. A new entry will appear in the texture list. Change its name to MARIOVIN and its width and height to 128. Now select Textures→New Patch and enter 106 in the PID field. In the texture display, you will now see that the texture is filled up with the MARIOW1 patch. Now add another patch to the texture and enter 310 in the PID field. You will see that the VINE2 patch has been 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 add three more VINE2 patches to the texture. When adding a new patch, the PID of the last one will be duplicated, so you won't need to change it. Now you need to change the position of the patches on the texture. This is done with the xPos and yPos fields in the patch list. Select the first duplicate and change its X position 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.

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 Texture for animated textures and the keyword Flat for 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 SAMPLE1 and the last is SAMPLE4, then SRB2 will cycle through the textures SAMPLE1, SAMPLE2, SAMPLE3, and SAMPLE4 for 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 Optional between Texture/Flat and the name of the first texture. This keyword has no effect in SRB2 and can be omitted.

Example

Flat LITEY1 Range LITEY3 Tics 4
Texture GFALL1 Range GFALL4 Tics 2

The first line defines an animated flat that cycles from LITEY1 through LITEY3, changing images every four tics. The second line defines an animated texture that cycles from GFALL1 to GFALL4, changing images every two tics.

See also

Personal tools
Namespaces

Variants
Actions
Navigation
SRB2
Modification
Community
Toolbox