Converting textures to the needed format.

I’m working on creating a player model for a friend in order to help me learn about adding custom models to Gmod as it will also help me to understand the process for when I decide to add a model I’ve made to Gmod as a player model.

The model is from a PS2 game and has it’s files as PNG’s. I’ve managed to get it rigged, it works in game. Only problem is that the textures aren’t there. I know I have the convert the PNG’s to a VMT and a VTF. I’m having trouble with the blender side of things, since I don’t know how to check if it is applied to the model. I was also unable to find any tutorials on converting models from other games, only on converting models from the Gmod workshop into playermodels, and I’ve already done that successfully.

If anyone could help me, I’d be very grateful.

Thankyou.

You could download SourceSDK and use it’s model viewer to see the model and it’s textures. It should be in the tools section in Steam.

Open your (propname).smd with notepad++ and you should see the name of the texture repeated many times.

If you have problems with applying textures in your 3D editor, you can check if textures are assigned by opening the exported smd in a text editor and checking for strings that get repeated over and over in the triangles section. Those are the textures your model is trying to load.

Yeah, I can see the triangles, so that means it is loading, could the problem be that the texture name in the SMD needs to match to the external texture file?

Your vmts must have the same name the model is looking for and have to be in the same folder you specify with $cdmaterials in your qc.

So can I edit the VMT name in the QC, or is a better idea to assign it in Blender, or should I just rename the VMT’s?

The qc file gives the compiler informations about the model, not about its materials. VMTs are text files which tell the engine about various shaders and material proxies the material will be using. VTFs are the actual textures.
You tell the model with the qc to search in a specific directory for its textures ($cdmaterials) and the engine how to show your texture inside the vmt.
The VMT has to have the name of the texture your model is looking for. You can’t rename them in the qc, just specify their location.

The .QC needs the $cdmaterials command like this:


$cdmaterials models/yourname/subfolder

The sub folder is where the .VMT files will be located. The names of the .VTF files don’t matter so much as long as the .VMT files direct the model to the right files.


$basetexture models/yourname/subfolder/texture_d
$bumpmap models/yourname/subfolder/texture_b

The .VMT files MUST be the same name as the textures applied to the model in 3DS Max, or whatever other tools there are. If the model has a material named “somematerial.png/.psd/.jpg/.xyz” the name of the .VMT MUST be “somematerial.vmt” because if it isn’t, you’ll have missing textures.

It also is required to have bones, and if you want it to have physics, you are required to have a $collisionmodel / $collisionjoints setup.

So, let me just get this as crystal clear as I can, say in blender the model has a material. Let’s say this material is called “face.BMP”, so, do I rename this to “face.VMT” so that it finds that specific file, or do I rename it just to “face” and it will find both face.VMT and face.VTF in the material folder?

You make a new vmt file, name it face.vmt, convert face.bmp to a vtf with vtfedit, name it whateveryouwant and write

inside of the vmt.

So, allow me to attempt to put this all together:

Name of material in blender = name of VTF
VTF points out the path for VMT - this path here, does it name the path of the materials file as it will be when it goes into a GMA, or should it be a path for where the textures will be when I compile the QC?

Also, the $CD materials in the QC. Is this path for when the model is compiled? Or when it is placed into models/materials/LUA files?

Because I just had a terrifying thought that the reason the textures aren’t working is because they’re not being picked up when it’s being compiled.

.VTF = Valve Texture File = Actual textures.
.VMT = Valve Material Text = Text files that direct to the .VTF files.
$cdmaterials = the path to the .VMT files

The $cdmaterials command goes to a FOLDER (i.e., $cdmaterials models/yourname/modelname)
The .VMT files MUST be named the same as the textures applied on the model in 3DS Max.
The .VTF files can be named joeblowfrommiamiflorida.vtf or literally anything else, as long as the .VMT file points out the location of the .VTF file.

Add me on Steam and I’ll walk you through it because it’s really simple shit.