Tutorial: Source Custom Materials Last edited 19 years ago2005-03-05 05:00:00 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.

This article was converted from a previous version of TWHL and may need to be reviewed

  1. The formatting may be incorrect due to differences in the WikiCode processing engine, it needs to be revised and reformatted
  2. Some information may be out of date
  3. After the article is re-formatted and updated, remove this notice and the Review Required category.
  4. Some older tutorials are no longer useful, or they duplicate information from other tutorials and entity guides. In this case, delete the page after merging any relevant information into other pages. Contact an admin to delete a page.
User posted image
At the time of writing, vtex.exe was the only tool avaliable to create Source textures. Nowadays, you can also use VTFEdit, a tool that is far more accesible to those who find vtex difficult/annoying (me included!) - Ant

Okay, so you've seen the regular HL? textures used over and over again. You want to create your own textures to liven your map and add some originality. The only problem is, HL? textures are more complicated to create than a simple WAD file. You can, however, create much more realistic textures using new methods.

What You Need

All you need is vtex.exe from your SteamSteamAppsyourusernamesourcesdkbin folder, plus a little imagination to actually make the texture (or a photo or similar, already prepared).

Step 1: Preparing Folders

N.B.: you may have to create the "sdkcontent" and "materialsrc" subfolders referred to here if you have not used the SDK up to recently. Go to your sourcesdksdkcontentmaterialsrc directory and create a folder. Name it something related to your map: in this tutorial I'll call this folder mytexes. Now, go to your game's material directory (in the case of HL?DM it would be half-life 2 deathmatchhl2mpmaterials and in the case of CS:S it would be counter-strike sourcecstrikematerials) and create another folder, with the same name as your previous one.

Step 2: Preparing VTEX

Now that you have set up your material directories, you must set up VTEX so that it will output all the right files to the right directories. Go to your bin folder (SteamSteamAppsyourusernamesourcesdkin) and find vtex.exe. Right click on it and go to Send To, then to Desktop (create shortcut) as illustrated below (may vary slightly according to your version of Windows):
The Send To menuThe Send To menu
Step 3: Making Your Texture

Now that you have finished all of your preparation, it is time to actually create your texture. First, you will have to have a Targa image file (.TGA) (it must be Targa). Export that from your preferred image editing program (IrfanView is a free program very capable of converting from a large variety of popular formats, and to Targa, if you don't have one).

Now export it to your directory that you created earlier (sourcesdk_contentmytexes). Open Windows Explorer or your alternative and go to the directory you exported the TGA to. Click your TGA and drag-and-drop it onto your shortcut to VTEX.

If this pops up, you have done everything correctly and can move on to step 4:
A successful VTEX processA successful VTEX process
In this situation, I have made the folder in the materialsrc folder, but not in the game material folder - I have created only one of the two required folders for your textures. If this is the case, refer back to Step 1.
A failed VTEX processA failed VTEX process
Step 4: Adding Material Attributes

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.

When you ran VTEX, it made an empty .txt file in your materialsrcmytexes folder. Open it with notepad or your selected text editor. Paste this in it:
"LightmappedGeneric"
{ "$basetexture" "yourfoldername/yourtexname" }
In the place of each yourtexname insert the name of your material (this being the name of your TGA) and in the place of yourfoldername insert the name of your texture folder (for me it would be mytexes).

Now, go to File -> Save As (not just 'Save'), and find your material directory (in the case of HL?DM it would be half-life 2 deathmatchhl2mpmaterialsmytexes and in the case of CS:S it would be counter-strike sourcecstrikematerialsmytexes). Once you are in the correct directory, enter "yourtexname.vmt" with quote marks as so:
The Save As dialogThe Save As dialog
You can now open Hammer and apply your texture to a wall, then compile and run your map!

5 Comments

Commented 16 years ago2008-03-03 06:41:35 UTC Comment #100697
Great Tutorial, Only Can you put details as in the measures of walls and things because, I don't know how big to make them and more details on setting custom attributes?
Commented 16 years ago2008-03-07 22:27:53 UTC Comment #100698
Nice, maybe have some more details about the vmf file and its attributes? And btw, can you make a tutorial about VTFEdit?
Commented 16 years ago2008-09-03 19:30:55 UTC Comment #100699
great, to answer some questions, the size for textures should be 512x512 pixels.
VTFedit its the same, you just need to get the texture files and the text file in your folder.
Commented 12 years ago2012-07-03 16:40:12 UTC Comment #100700
Outdated tutorial, use vtfedit ;)
Commented 3 months ago2024-09-10 17:58:34 UTC Comment #106384
VTFEdit is no longer maintained, so I changed the section to talk about VTFEdit Reloaded instead. I believe it should work the same. It's a fork of VTFEdit

You must log in to post a comment. You can login or register a new account.