For the purposes of this guide, the texture name will be
and the created files will be
Creating the image
Create your texture image (in any file format like JPG, PNG, TGA, etc.). The only requirement is that the dimensions are powers of 2 - that means the width and height must be numbers like 256, 512, 1024, etc. Once you've done this. continue to the next step.
is a very convenient tool that allows you to create Source textures without having to mess around with command line tools. This is the recommended way to create your textures. Install and open VTFEdit.
First go to
File > Import...
and select your texture image file. You will be presented with a range of options, but the defaults are fine. Click OK to continue.
After the import, the texture will be shown in the main window. Again, you will have some options, but you can ignore them. Simply go to
File > Save
and save the VTF file to
Next go to
Tools > Create VMT File
. You will have some more options, but the defaults will work correctly. Click Create and save the VMT file to
You can now open Hammer and apply your texture to a wall, then compile and run your map!
More information: Vtex - VDC
VTEX is Valve's official tool used to create Source textures. It's a command line tool located in the
folder of the game install. For example, for HL2, it is located at
<steam install>\SteamApps\common\Half-Life 2\bin\vtex.exe
. VTEX is a command line tool which means it can support more advanced scripting techniques to convert textures in batches rather than one at a time. If you're not familiar with command line tools, you should use VTFEdit instead.
If you run
without any parameters, the usage instructions will be printed:
Usage: vtex [-outdir dir] [-quiet] [-nopause] [-mkdir] [-shader ShaderName] [-vmtparam Param Value] tex1.txt tex2.txt . . .
-quiet : don't print anything out, don't pause for input
-warningsaserrors : treat warnings as errors
-nopause : don't pause for input
-nomkdir : don't create destination folder if it doesn't exist
-vmtparam : adds parameter and value to the .vmt file
-outdir <dir> : write output to the specified dir regardless of source filename and vproject
-deducepath : deduce path of sources by target file names
-quickconvert : use with "-nop4 -dontusegamedir -quickconvert" to upgrade old .vmt files
-crcvalidate : validate .vmt against the sources
-crcforce : generate a new .vmt even if sources crc matches
eg: -vmtparam $ignorez 1 -vmtparam $translucent 1
Note that you can use wildcards and that you can also chain them
e.g. materialsrc/monster1/*.tga materialsrc/monster2/*.tga
Hit a key to continue
folder, there's also a
folder that sets some environment variables to make things a bit easier to deal with. This is a simple batch file that just calls
, there's nothing magic about it.
Typically when setting up custom materials you put your source files in the
directory as TGA files. You can create subfolders in this directory to reflect the folder structure you want in the
directory. You do not include the
folder when releasing your map/mod.
When using VTEX, your image file must be the TGA format. Any image editing software (except mspaint) will support this format. Save your texture as TGA and place it in the
folder before you continue.
Next, use VTEX to convert the TGA into the VTF format. Open a command line and run the following (assuming you are using HL2):
The output should be something like the following:
<steam>\SteamApps\common\Half-Life 2> .\bin\vtex.bat .\hl2\materialsrc\texturename.tga
Configuring Source SDK environment variables for Half-Life 2
Executing: ".\bin\vtex.exe" -game ".\bin\..\hl2" .\hl2\materialsrc\texturename.tga
input file: ./hl2/materialsrc/texturename
output directory: ./hl2/materials
no config file for ./hl2/materialsrc/texturename.tga
SUCCESS: Vtf file created
Hit a key to continue
Creating a VMT
More information: VDC - Material
Now that you have created your actual texture, it is time to create its material attributes (what it sounds like when dropped, whether it has any special cubemap properties etc.). If you are going for a basic texture with no specific material properties, then follow the instructions below.
Create a new file in your
directory and call it the same name as your texture, except with the extension
. Open this file in Notepad or any other text editor. Add the following content to the file:
Save the file and close Notepad. You can now open Hammer and apply your texture to a wall, then compile and run your map!
This guide will use two different methods to create a VMT and VTF pair for a simple Source texture. These techniques work with any Source game.