Adding Custom Textures
So you're creating your own level, and want to add your own custom textures to use on the geometry?
For this tutorial you must know:
- How to create your own textures using an image editing program (if you don't know how, this tutorial on GFXArtist may help).
- How to create brushwork inside a working map (if you don't know this, see the tutorial for A Simple First Map).
This tutorial covers:
- How to create a new material file from scratch.
- How to edit and reload your materials while running the game
These are the terms that will be used throughout the tutorial, so make sure you know which is which!
- These are the high-level "containers" for materials. They can store any number of material declarations. They are simply text files with the file type of .mtr (for example C:\ETQW\SDK\base\materials\mapobjects.mtr), and can be edited in any text-editing application like Notepad.
- Also known just as a "material". This is the text description of a single material. It contains the paths to any textures you want to show up in the game.
Tips when creating textures
To make sure that your materials will work properly, your texture images need to be the right size, and the right format.
All textures should be .tga (Targa) format.
- Always use uncompressed Targa files (don't use RLE compression when saving textures).
- Use 32-bit Targa files for anything which needs an alpha channel for effects (eg. transparency).
- Use 24-bit Targa files for everything else.
All textures should be sized in pixels to a power of 2.
- Textures do not have to be square, but the length of the sides must be powers of 2.
- This means that the width and height of your images could be sized like 64x64, 256x128, 512x1024, etc.
- But they could not be sized like 57x57, 257x120, 600x1020, etc.
Creating a material file
You could start by just putting extra material declarations into an existing .mtr file, but this can become messy and hard to keep track of. It's best to create your own .mtr file to store all your custom materials.
If your new textures are part of a set for a specific map, it is sensible make a new material file in the /materials/ folder called <span style="padding: 0 0.5ex; background: #def;" title="A file or folder named '<mapname>.mtr'"><mapname>.mtr. The easiest way is to create a new, empty .txt file and just rename the extension to .mtr .
You should now be able to use your new textures as part of your custom level.