Practical Texture & Model Compile Tutorial
for Source-Engine Games/Mods
Introduction:
I will try to explain everything in a way so that it is easy to understand + I will try to give you a bit a look into the system of source engine games/mods of how they handle things so that you are able to face your future scenarios maybe with just logical thinking. Through this tutorial I will show to you a real practical scenario of a task you might also be confronted with. Its a static prop I developed for a mod for a Xen environment.
The idea was to make a in game-prop which makes use of the latest techniques to make it look as much realistic as possible, combined with features the source engine provides to keep it performing efficient so that it can be used multiple time in a in game scenario without hurting the graphic budget.
Words will be much slower than the next picture:
So what do we have there.... a 3d model (from XSI) & a colortexture, normalmap, secularmap(from Photoshop & Zbrush) and we want to compile a static prop for HL2 out of that.
We want to find the model under a folder named "props_xen" with the filename "xen_organic_pillar.mdl" to keep everything organized.
File Structure Organization:
One thing I want to show you before I start with the specific tutorials. I know when you begin with modeling/texturing/mapping you want some quick results and dont want to spend too much time organizing folders or such things, but I can tell its worth the time (always).
Things will grow and everything gets disorganized quickly. To make you working comfortable try to keep things organized from the beginning. I saw a lot of people giving up there passion or talent because of such small burdens with which they get confronted after a certain time.
The plan of the Valve people is that there is a "Source" - and "Game" - side.
The Source-side begins with "\sourcesdk_content\*ModDir*\..."
The Game-side begins with "\*Modname*\*ModDir*\..."
In our case (prop for HL2) we will work with this 2 directorys:
| source-side: | "..\*Steamfolder*\Steamapps\*username*\sourcesdk_content\hl2\..." |
| game-side: | "..\*Steamfolder*\Steamapps\*username*\half-life 2\hl2\..." |
Whenever I use the word Sourceside/Gameside in this tutorial you should know where we are.
Here is a image where you can see how we can
set up a perfect folder structure for our scenario:

Texture Compiling:
We have set up the folder structure, now how to compiling texture files? We have the model "xen_organic_pillar" and 2 texture files "xen_organic_pillar.tga" (colortexture) "xen_organic_pillar_normal.tga" (normalmap & specularmap). I will go from compiling the texture to compiling the model later.
First i want to give you a introduction on how the source engine reads/handles texture files. It is organized like that that there are ".vtf" files (compiled texture images) & ".vta" files (Text file with information for the engine which shader will be used...)
Take a look:

Now which tools do we need and how to handle them?
Here is a picture of the workflow of the texture compile task:

We are now at the point where it comes to the compiling process. There are some cool tools out there for compiling textures in many different ways, I describe you now the way I am using and which I find quick & comfortable to work with. (Its from Valve)
This will create us a right-click shortcuts for our Source ".tga" files.
We now have created a option to compile a ".tga" to a ".vtf" ("VTF - create"), but to have more comfort and to be quick we want to make 2 other types (step 7 to step 14):
The 3 working "Action for Filetype: TGA" Dialogs should look then like this:
|
Now you should have a comfortable base for compiling textures. Vtex alone will convert a ".tga" file into a ".vtf file". The other two will do the same + generate a basic ".vmt" file for the ".vtf" with the corresponding shader.
There are different types of shaders which are used to display a texture on models/world brushes/sprites... .
The types you would probably use often are the Vertexlitgeneric (Used for models) and the Lightmappedgeneric (Used for world textures). for our case, the xen_organic_pillar (Model) we must use the Vertexlitgeneric shader.
So right click at the "xen_organic_pillar.tga" and choose "VTF - Vertexlitgeneric". This will make a ".vtf" file of the "xen_organic_pillar.tga" & a ".vmt" file with a basic Vertexlitgeneric shader which points to the just created compiled texture ("xen_organic_pillar.vtf").
Everything should be now on the gameside - "*ModDir*\materials\models\props_xen\" folder. If not then check if you have created the same folder structure for both sides (Sourceside <-> Gameside).
For the normalmap texture we need to choose "VTF - create" because he needs no extra ".vmt" file because he will later be called in the "xen_organic_pillar.vmt".
Then the last step, the ".vmt" file editing.
We open the "xen_organic_pillar.vmt" with the windows editor/notepad (gamedir...) :

& We are finished with the texture creation.
--> Part 2 / Static_prop compile
