Custom Textures in HL2 and CS:S
by darkdruid (view all articles)

2 ratings / 4.5 stars
Learn how to use custom textures in HL2 and CS:S.
by darkdruid (view all articles)

2 ratings / 4.5 stars

Ok, welcome to my first tutorial here on the The Snarkpit. This tutorial is going to teach you how to create custom textures for the source engine. Now this is a basic texture tutorial and I won't be defining our textures as materials, you can find a link to them further on in the tutorial.
The first thing I need you to do is go into your [b]sourcesdk_content/cstrike/materialsrc[/B] folder. If you're mapping for HL2DM or another mod, use a similarly named folder- if it doesn't exist, you'll need to use the[B]real game directorymaterialsrc[/B] folder instead.
I am going to need you to make a new folder in this directory, you can call it anything you want, but it should be something easy, maybe like 'customtex'. We will use this folder later on.
Now open up the [B](email@whatever.com1)/counter-strike source/cstrike/materials[/B] folder and create a new folder with the same name as the last folder; for me it would be 'customtex' - otherwise VTEX might give you an error when compiling!
Now go to the sourcesdkbin folder and find the vtex.exe file. Right click on it, and got to Send To: then click Desktop (Create Shortcut). You will now see a vtex.exe shortcut on your desktop, leave it there, we will come back to it later.
This image basically illustrates what's going to happen:
[IMAGE NOT AVAILABLE]
The first thing you need to do is find a texture you want to convert. For this tutorial I will be using this rock texture:

You can right click and save that to disk because we will be needing the image.
The image you just downloaded was 512x512. Half-Life 2 supports texture sizes that are powers of 2- 32x32, 64x64, 128x128, 256x256, and 512x512. All of those image sizes are clearly square.
Now what we will need to do is get our rock076.jpg into a tga. So now open up The Gimp, or Photoshop, because we have to save the image, save the image as a 16, 24 or 32-bit TGA with the name: rock076.tga in your [B]sourcesdk_content/cstrike/materialsrc/customtex[/B] folder.
Now quit out of your image editing program and find your rock076.tga file that you just saved to [B]sourcesdk_content/cstrike/materialsrc/customtex[/B].
What you will need to do is drag the rock076.tga onto the vtex.exe shortcut on your desktop. What will happen is it will process your file and output a rock076.vtf in your
[B](emai@whatever.coml)/counter-strike source/cstrike/materials/customtex[/B] folder.
You're not home free just yet. It also created a blank .txt file in your [B]materialsrc/customtex[/B] folder.
Open your rock076.txt file and place this inside:
Further documentation on making VMT files can be found on the [B]Hammer help pages[/B].
***[UPDATED on Aug 27, 2008] I once again updated this tutorial after seeing the error most of you are getting. Sourcesdk now exports the textures into the games materials folder. If you have been having problems look over this and try it again.
The first thing I need you to do is go into your [b]sourcesdk_content/cstrike/materialsrc[/B] folder. If you're mapping for HL2DM or another mod, use a similarly named folder- if it doesn't exist, you'll need to use the[B]real game directorymaterialsrc[/B] folder instead.
I am going to need you to make a new folder in this directory, you can call it anything you want, but it should be something easy, maybe like 'customtex'. We will use this folder later on.
Now open up the [B](email@whatever.com1)/counter-strike source/cstrike/materials[/B] folder and create a new folder with the same name as the last folder; for me it would be 'customtex' - otherwise VTEX might give you an error when compiling!
Now go to the sourcesdkbin folder and find the vtex.exe file. Right click on it, and got to Send To: then click Desktop (Create Shortcut). You will now see a vtex.exe shortcut on your desktop, leave it there, we will come back to it later.
This image basically illustrates what's going to happen:
[IMAGE NOT AVAILABLE]

Starting off: the texture
The first thing you need to do is find a texture you want to convert. For this tutorial I will be using this rock texture:

You can right click and save that to disk because we will be needing the image.
The image you just downloaded was 512x512. Half-Life 2 supports texture sizes that are powers of 2- 32x32, 64x64, 128x128, 256x256, and 512x512. All of those image sizes are clearly square.
Now what we will need to do is get our rock076.jpg into a tga. So now open up The Gimp, or Photoshop, because we have to save the image, save the image as a 16, 24 or 32-bit TGA with the name: rock076.tga in your [B]sourcesdk_content/cstrike/materialsrc/customtex[/B] folder.
Making it into a texture/material
Now quit out of your image editing program and find your rock076.tga file that you just saved to [B]sourcesdk_content/cstrike/materialsrc/customtex[/B].
What you will need to do is drag the rock076.tga onto the vtex.exe shortcut on your desktop. What will happen is it will process your file and output a rock076.vtf in your
[B](emai@whatever.coml)/counter-strike source/cstrike/materials/customtex[/B] folder.
You're not home free just yet. It also created a blank .txt file in your [B]materialsrc/customtex[/B] folder.
Open your rock076.txt file and place this inside:
Code
<div class="pre"><pre>"LightmappedGeneric"
{
"basetexture" "customtex/rock076"
}</pre></div>
Save the .txt file and rename it to rock076.vmt. Then copy the rock076.vmt and .vtf files into your [B]counter-strike source/cstrike/materials/customtex[/B] folder, restart Hammer, and it will appear!{
"basetexture" "customtex/rock076"
}</pre></div>
Further documentation on making VMT files can be found on the [B]Hammer help pages[/B].
***[UPDATED on Aug 27, 2008] I once again updated this tutorial after seeing the error most of you are getting. Sourcesdk now exports the textures into the games materials folder. If you have been having problems look over this and try it again.