Post tutorial Report content RSS feed Replacing Textures on Half-Life 2 Models

This tutorial shows you how to replace textures on models from Half-Life 2.

Posted by Hezus on Jan 28th, 2011
Basic Textures.

Half-Life 2 offers quite a lot of content. As a mapper you can easily fill your world with props and make your level look good. Although sometimes these props do not really fit your setting or colour scheme. If you are also a modeller you'll be able to make your own model, but most mappers lack this ability. Do not dispair, you can adjust props fairly simple.

Note: This tutorial will only cover how to change the textures. The shape (mesh) of the model cannot be changed without modelling knowledge.

First off, find a prop you want to change. I want to use this sink, but all the smudge and dirt does not fit my environment so I need to get rid of it. To do this I'll need to find the right paths of the model and the location of the material (the texture) it uses.

1. Finding the texture
Go into Hammer and place a prop_static and Browse to the above sink prop (furnituresink001a.mdl). Now when you're in the Model Browser, note the MOD (HL2) and the path where you can find this prop, which is ../props_c17/

Now go into Source SDK and open the Model Viewer. Open the sink model in ../props_c17 and check the MODEL tab. To the right you'll see a dialog box (VMT's Loaded) and it shows you a list of materials the model uses. These are the actual textures. Take note of the path: ../models/props_c17/furnituretoletsink001a (notice the typo? bad Valve.. ;) )

These textures are not just freely available in the HL2 folder. They're stored into package files called GCF's. To acces them you'll need a programm called GCFScape. Download it here and install it. Open the programm go to File -> Open and find the source materials.gcf file. It's found in your Steam folder at ../Steam/steamapps/.

Browse to the sink material and take note of the folder structure: ../hl2/materials/models/props_c17/
You'll see that there are 2 materials: furnituretoletsink001a.VMT, and furnituretoletsink001a.VTF. The VMT file is used to define properties and paths of the texture. More on VMT's later. The VTF is the actual texture. Extract the VTF file somewhere where you can find it.

2. Editing the Texture
While Source can read these VTF files just fine, your favourite editing programm can't. This means you'll need to convert them and for that you'll need another programm: VTFEdit. Download and install. Open VTFEdit and open the furnituretoletsink001a.vtf file. Then Export it (File -> Export) and save it as a BMP file. Now you can open it with any editor.

I used Photoshop CS4 to brush the smudge away and recreated a few details. Note that you'll have to keep to the layout of the orignal texture. For instance: the faucet uses a different part of the material than the porcelain sink. If you want to change the colour of the faucet, only edit the part of the texture the faucet uses. The same goes for details on the texture. You can't place the drainage hole in the sink in a different place without messing up the looks of the model.

Edit the BMP till you are happy with the results. Now you'll have to convert it back to VTF. Open VTFEdit and import the BMP (File -> Import). Click OK to accept the default settings. Now Save As and overwrite the orignal furnituretoletsink001a.vtf file. Make sure you use the exact same name or else Source won't be able to find the texture, unless you edited the VMT file as well.

3. Replacing the Texture
Now comes the tricky part. You can't just place this VTF back into the GCF package file. But luckily the folks at Valve were nice enough to offer us an alternative: you can place the texture in your HL2 folder manually. Source will always pick the manually placed file over the one in the GCF file as long as you correctly mimic the folder structure.

In GCFScape we've seen the folder structure for our VTF file: ../hl2/materials/models/props_c17/. Now go into your Steam/steamapps/youraccount/ folder and find the MOD you are mapping for. I'll use the regular Half-Life 2 folder. As you can see this contains the ../hl2 folder, just like in GCFScape. Go into this folder and recreate the folder structure -> /materials -> /models / props_c17/. Now put your furnituretoletsink001a.vtf file into the newly created ../props_c17 folder.

NOTE: if you are using Episode 1 or Episode 2, do not use the ../hl2 folder, but the ../episodic (for Ep1) or ../ep2 (for Ep2) folder.

Now go back into Hammer and if you've done it all correctly, you'll see your new texture on the sink. And it might just look like this. Nice and clean and perfect for my environment.

Additional Info on VMT's:
VMT's are text files that define the properties of a texture. If you change a wood texture to rock, you want the engine to know that. Extract the VMT file and edit it. For instance, "$basetexture" will define the path where the material can be found and "$surfaceprop" defines the material type. For more full listing and explanation check the Valve Developer Community here.

Post comment Comments
wazanator Jan 31 2011 says:

Great tutorial :)

+1 vote     reply to comment
Guest Oct 8 2013 says:

This comment is currently awaiting admin approval, join now to view.

Post a comment

You are not logged in, your comment will be anonymous unless you join the community. Or sign in with your social account:

Related Games
Half-Life 2: Episode Two
Half-Life 2: Episode Two First Person Shooter