A .VMT file is created out of the .TGA and .TXT file. It defines the lighting model, the base texture, and any other channel, such as proxy shaders. It can viewed as the material output, but not what is seen in the engine. The output is called a .VTF file. Figure 1.2 shows an example of a .VMT.
"VertexLitGeneric" { "$baseTexture" "table_pole" }Figure 1.2, a VMT file
In $baseTexture the base texture is defined. This a very simple .VMT file. The Valve Developer community provides a much detailed example http://developer.valvesoftware.com/wiki/Materials_for_models.
The .TGA file is converted to a .VTF with an application called Vtex. I used a tool found on the internet to generate this file, it is called VTFTool (http://www.wunderboy.org/sourceapps.php/).
Creating a .VTF file:
Note: the program comes with a lot of options; one of them is "use config.TXT". This is the only one I used and I did not get any errors, but the developer mentions that the program is not error proof.
Figure1.3, VTFTool
The package of Half Life 2 comes with a command line program that creates the Half Life model files. It's called StudioMdl.exe. It uses the .qc file to find the relevant .SMD and texture files. The resulting product is a Half Life model file, .MDL, which contains all the necessary data (such as geometry, animations, etc). Besides creating the .MDL, it also provides feedback on the amount of memory used for compiling the model. This can be useful in debugging and optimizing the model.
For the creation of the models during this project, we made use of a GUI that generated the .MDL file. It is called GUI StudioMDL 2.0, and can be found on the following website: www.wunderboy.org. Before compiling the .MDL you first have to set up the necessary paths so that the studiomdl.exe and the GameConfig.txt can be found. This text file is used to select for which game or mod you are creating the models. A step-by-step installation and compiling procedure:
The resulting .MDL file can be viewed with Half Life Model Viewer (HLMV). If your textures won't show up, you will see pink/black checkers. This means that HLMV couldn't find the textures. For this problem there are two possibilities.
Figure 1.4, GUI StudioMDL 2.0