Tutorials

Re-Skinning Models



Right, this uses the same method as my re-scaling models tutorial, but is probably a lot more useful lol! A lot of people have probably figured out how to do this already, but for those who haven’t, here ya go. First things first, I have had only limited success doing this for character models, and if you wanna re-skin CS characters don’t even try, it simply wont work on any other machines. I’m intending this to be used for props, everyone’s gotta be sick and tired of the HL2 props by now!

This method is again quite long, but worth it. It’s safe, you end up with a separate copy of the model and it’s textures, so it’s easily distributable without risk of filename conflicts etc.

Best thing about this method? You don’t need to use 3D software anywhere. (You will need image editing software, however!)

Theory
What we’re gonna do is decompile the prop we want, extract the textures it’s looking for, then edit those textures and recompile the model to a different place, pointing at our new textures.

What You’ll Need
1) Cannonfodder's MDL decompiler. Said it before, I’ll say it again: God bless cannonfodder, for he maketh great HL2 tools.
2) GCFScape. You must know what this does by now, allows access to Valve’s storage files (.gcf) so we can get Valve content out for editing. Major props to Nem for all his incredible half-life work as well, he’s also the daddy.
3) You need to be able to open/save, or decompile and recompile, VTF files – read primer tutorials on texture creation if you don’t know how. I’m not gonna cover it all here, cos a) it’s beyond this tut’s scope, b) it’s covered elsewhere properly, and c) I don’t know how it’s normally/best done these days, cos I simply use nem’s VTF plugin for photoshop (link above) – highly recommended.
4) Image editing software – Photoshop ftw of course, but Paint Shop Pro and the GIMP will do you proud too.

--------------------------------------------------------------
Step 1 – Getting the model, and editing it’s QC
--------------------------------------------------------------

Fire up Cannonfodder’s decompiler and browse to the model you want to reskin. For this example, I'll be reskinning models/props_wasteland/cargo_container01.mdl , cos that bloody Northern Petroleum logo is in every map ever.
news post image

The screenshot doesn't show it, but the path I've set for the 'Output Directory' is c:\ Steam\SteamApps\***\sourceSDK_content\hl2\modelsrc\Jesta\.

This bit's really important: Obviously, if you're doing this for HL2MP or CS:S, then put it in the modelsrc folder for that mod. but always make a separate subfolder, with your name, or the name of your map, or something memorable.. This not only makes it easier to find, it also ensures against any file conflicts with the original model - which makes it distributable.

Now press 'Extract', let it work through, then close. Navigate to the folder you extracted to. You'll see something like this:
news post image

Open up the mdldecompiler.qc file in Notepad, or whatever text editor you wanna use. You'll see something like this:


$cd "C:\Steam\SteamApps\owen_rl_smith@hotmail.com\sourcesdk_content\hl2\modelsrc\Jesta"
$modelname "props_wasteland\cargo_container01.mdl"
$model "Body" "cargo_container01_reference.smd"
$lod 100
 {
  replacemodel "cargo_container01_reference" "lod1_cargo_container01_reference"
}
$cdmaterials "models\props_wasteland/"
$texturegroup skinfamilies
{
	{ "cargo_container01.vmt" }
	{ "cargo_container02.vmt" }
	{ "cargo_container03.vmt" }
}
$hboxset "default"
$hbox 0 "static_prop" -63.051  -192.101  -60.343  64.948  195.440  67.657
// Model uses material "cargo_container01.vmt"
// Model uses material "cargo_container02.vmt"
// Model uses material "cargo_container03.vmt"
$surfaceprop "metal"
$keyvalues  { prop_data { "base" "Metal.Large" "allowstatic" "1"  } } 
$illumposition 0.948 1.670 3.657
$sequence idle "idle" fps 30.00
$collisionmodel "phymodel.smd" {

	$concave
	$mass 8000.0
	$inertia 1.00
	$damping 0.00
	$rotdamping 0.00
}



Firstly, since we’re gonna make our own copy of the model, we need to change that second line. Instead of

 $modelname "props_wasteland\cargo_container01.mdl"
 

we want

 $modelname "Jesta\cargo_container01.mdl"
 

Stick a folder name of your choice there – recommended is the name of your map.

Now we have to point the model to a different set of textures. We can’t change the name of the texture file the model looks for, because that would require 3D software, which we’re avoiding. So instead we’re gonna change the folder it looks for the textures in.

So, change this:

$cdmaterials "models\props_wasteland/"


To this:

$cdmaterials "jesta\container_reskin/"



Make a note of the original folder name, we’ll need it in a second. Again, choose a name that’s recognizable. It doesn’t have to be the same as the one above, they’re in totally separate locations. But it’s probably neatest to use something related, as I am in this example. Consistency is no bad thing, and could save you hassle and time.

So far, we’ve got a decompiled model, that is ready to be recompiled under a different name, and which will look for its textures in a different folder. What’s missing? Those textures, of course.

--------------------------------------------------------------
Step 2 - Editing the material files
--------------------------------------------------------------

Have a look at the textures used:

// Model uses material "cargo_container01.vmt"
// Model uses material "cargo_container02.vmt"
// Model uses material "cargo_container03.vmt"



Now, as you know/have guessed, this model has three possible skins. For our purposes we only need edit one, I’m gonna use the first.

So, now we fire up GCFScape (close steam first), and open up the relevant GCF. In this case, it’s c:\Steam\SteamApps\source materials.gcf. Browse through to the original directory listed in the QC file (for me, "hl2\materials\models\props_wasteland/" ) and find the VMT your QC specified (for me, “cargo_container01.vmt”). Extract it and open it up – we need to find out what VTFs the VMT is using. In most cases, it’s obvious from the filenames (so in this case I quite clearly want “cargo_container01.vtf” and maybe “cargo_container01_normal.vtf”) but it’s not always so clear – so get the VMT out, open it up and find out.

Once you know what VTFs you want, extract them. Now, dump all the VTFs and the VMT(s) into the new, self-named folder you specified in the QC: in my case, they’re all going into C:\Steam\SteamApps\****\Half-Life 2\hl2\materials\jesta\container_reskin\. This is the materials folder of the game we’re modding (in this case HL2), plus the name from my QC file. So if I was doing this for CS, I’d use C:\Steam\SteamApps\***\Counter-strike Source\cstrike\materials. Got it? Good.

Now we have all the materials in our new location, it’s time to edit them. Open up your VTF and change the paths to whatever new folder you have. I’m only changing the base texture, so my VMT goes from

 "VertexLitGeneric"
{
     "$basetexture" " models\props_wasteland\cargo_container01"
     "$surfaceprop" "metal"
     //"$envmap" "env_cubemap"	
     //"$normalmapalphaenvmapmask" 1
	"$bumpmap" "models\props_wasteland\cargo_container01_normal"
} 

to

 "VertexLitGeneric"
{
     "$basetexture" "jesta\container_reskin\cargo_container01"
     "$surfaceprop" "metal"
     //"$envmap" "env_cubemap"	
     //"$normalmapalphaenvmapmask" 1
	"$bumpmap" "models\props_wasteland\cargo_container01_normal"
} 



Notice the way the paths work relative to the ‘materials’ folder – this is the cause of so many confusions. Compare my VMT paths to my absolute paths above, you should see how much of the path you need to specify.

Now you just need to actually do the re-skinning: let your imagination (and the clone-stamp tool )...go wild! I’ll leave this part up to you – you may have to decompile the VTFs to TGA then recompile them, you need to find that out elsewhere. Edit away, use your imagination. Here’s my efforts:

Before:
news post image
After:
news post image


Ok, so it’s not great, but it’ll do.

Now, welcome back. Hopefully, you now have your edited textures all in the new folder, specified earlier, something like these. Note the path name.
news post image
No need to keep the old VTF, I just did that cos of the way I was saving my files.


Okey, dokey. So we now have everything we need to recompile the model. The qc has been modified to a) a new model name, b) new texture directory. And the extracted materials have been put into that directory, and edited. Hopefully. Let’s compile the model.

--------------------------------------------------------------
Step 3 - Compiling & Finishing Up
--------------------------------------------------------------

This bit’s pretty easy to be honest, just create a text file somewhere (desktop’s probably best unless you’re doing this lots), and type the following:
1) The path to studiomdl.exe (in your sourcesdk “bin” folder), followed by..
2) The path to your decompiled and edited QC file.
These should both be all on one line, each in quotes.
Then on a new line type ‘pause’ (so you know when it’s done and can read any error messages)

So for me, my text file looks like this:

 "C:\Steam\SteamApps\***\sourcesdk\bin\studiomdl.exe" "C:\steam\SteamApps\***\sourcesdk_content\hl2\modelsrc\jesta\mdldecompiler.qc" 

pause



Rename that text file to whateveryouwant.bat, run it, and your model will be compiled! Lastly, open up modelviewer, and you should see a folder with the name you provided way back at the start, in there will be your lovely re-skinned model!


Here’s mine in modelviewer:
news post image



Notes & Tips:

-Cannonfodder’s decompiler doesn’t much like the beta SDK, you’ll have to revert to the old one to use it (which involves completely deleting your sourceSDK folder, and it’s GCF. Back up your game configs first!)

-On a similar note, if you’ve got, or had, the beta SDk, you may have trouble with modelviewer. Fix as above.

-The most problems in this are path names. If you’re having trouble, go back and check every path reference. If people are having trouble, I’ll post a breakdown of all the paths later.

Anything I’ve missed or explained badly? Or anything I’ve simply got wrong? It's 3.30 AM and there's a fair chance i've missed something. Reply below, it’ll be updated, i'd like to know how easy this tut is to follow.

-Jest@-

View comments ( 27 )

Back to top