Submitted by
Andy on Fri, 2004-11-12 06:49.
The following tutorial has been republished with consent:
- By Adam "Phatsniper" Owen
It seems the new material system has caused some confusion within the community, so here's a basic guide to get your custom textures working.
I'm going to be using Adobe Photoshop 7, but any image editing program with the ability to export to Targa (.tga) will suffice.
Please note, in order to save .tgas with alpha channels in Photoshop 7 you will need this bug fix.
Open your image in Photoshop and go to File > Save As and save it to a sub directory inside your SDK's materialsrc directory.
For example :
"Steam\SteamApps\USERNAME\sourcesdk\cstrike_sample_content\materialsrc\test"
You can choose any folder name you like, I just called mine test. In the window that pops up select "24 bits/pixel", turn off "Compress (RLE)" and hit Ok.
Open up Windows Explorer and browse to the materialsrc directory, copy the new folder you made containing your texture, and paste it in your:
"sourcesdk\cstrike_sample_content\materials" directory".
Finally, browse back into your "materialsrc\test
(or whatever you called it) directory and move it out the way / minimize it for now.
Ok now we've got the folders set up we can go ahead and create the .vtf file. We do this by running the "vtex.exe" program that resides in your "sourcesdk\bin" directory.
Open a new Windows Explorer and browse to:
"Steam\SteamApps\USERNAME\sourcesdk\bin"
Now re-open your sub folder and drag your .tga file across to the other window and drop it onto the file "vtex.exe". A Command Prompt window will pop up and create a .vtf file of your texture. Don't worry when the message about a missing file appears, it will create the empty .txt file you need. Just hit spacebar when it's finished to get rid of the window.
We're nearly there now, just a couple more things left to do.
Close the "sourcesdk\bin" window and browse to
"sourcesdk\cstrike_sample_content\materials\test"
.
Right click and select New > Text Document. This is going to be our .vmt file that you use to set which shaders will be applied to the .vtf texture.
To keep things simple just paste this into the document :
"LightmappedGeneric"
{
"$basetexture" "test/test01"
}
This tells the engine to render the texture with lightmapping.
Save the file, close it and then rename it to "test01.vmt". Last thing to do is copy your
"sourcesdk\cstrike_sample_content\materials\test"
folder and paste it in:
"Steam\SteamApps\USERNAME\counter-strike source\cstrike\materials"
We're done! Load up Hammer and your texture will be in the texture browser.
Of course, this is just scratching the surface on what you can do with materials. You can change surface types, sounds, shaders and even physics properties. I know the new system is a bit fiddly but I do find it helpful to have all your textures imported and sorted automatically as folders.
Thanks for reading and good luck!
As usual don't hesitate to contact me with any questions or comments!
Hidden and Dangerous: npc_sniper
Reducing Vis Times