Part 1

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:

Compile overview

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:

Filestructure


 

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:

Texture read


Now which tools do we need and how to handle them?

Here is a picture of the workflow of the texture compile task:

Compile Workflow

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.


1. Open a Windows Explorer window (Windows key + E).
2. Go to Tools > Folder options.
3. Select the “File Types” tab and scroll down until you see the TGA extension.
4. Click TGA so that it is highlighted.
5. Click the “Advanced” button at the bottom of the panel.
6. You should now see the “Edit File Type” panel.
7. Click the “New…” button.
8. In the “Action:” box type “VTF - create”.
9. Now click the “Browse…” button and locate your vtex.exe file. (It will be in “bin” directory of the sourcesdk directory. = "...\Steam\SteamApps\*username*\sourcesdk\bin\vtex.exe")
10. The “Application used to perform action:” box should now read something like ...\sourcesdk\bin\vtex.exe %1. change it to "...\sourcesdk\bin\vtex.exe -mkdir %1
11. Click in the little box next to “Use DDE".
12. In the “Application” box type “vtex”.
13. In the “Topic” box type “System”.
14. Hit OK on all the panels to accept the changes.

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):

"Action:" “Application used to perform action:”
   
VTF - create Vertexlitgeneric "..\Steamapps\*username*\sourcesdk\bin\vtex.exe -mkdir -shader vertexlitgeneric %1"
VTF - create Lightmappedgeneric "..\Steamapps\*username*\sourcesdk\bin\vtex.exe -mkdir -shader lightmappedgeneric %1"

The 3 working "Action for Filetype: TGA" Dialogs should look then like this:

Action for TGA Filetype

 

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...) :

Vmt File editing

& We are finished with the texture creation.

 

--> Part 2 / Static_prop compile

2d-art 3d-art tutorials