- Apr 9, 2008
- 1,708
- 1,489
In chat theres always people asking how to reskin models. It's something that's quite difficult to explain in chat due to it being quite a laborious process so here's the complete guide on how to decompile and recompile a model with new skins!
The Process
The process is quite simple. Here's a simple list.
So that's the process in it's simplest form.
For this tutorial we will recompile one of the props_mining rocks with a new name.
What you need
Tools
TIP: Place GUIStudioMDL in the 'sourcesdk/bin/orangebox/bin/' folder and MDLDecompiler in the 'sourcesdk/bin/ep1/bin' folder and create shortcuts for both of them on the desktop so they're easier to get to.
Step 1: Extract the model
First off, load up GCFScape then open up 'team fortress 2 content.gcf' which can be found in the 'steam/steamapps/' folder. Then you can navigate to the models using the menu or you could simply search for the model we are looking for. To do this choose Edit > Find then type 'rock001'.
Now you'll have a list of files like so.
You will see a whole bunch of files with the name 'rock001' and all these files are neccesary to successfully recompile it.
Select them all then right-click and choose 'Extract...'/i]. Place them any place you like and that's that!
Step 2: Hex edit the model
Cannonfodder's MDLDecompiler was coded for use with EP1 models but models in the Orangebox engine use a different model version which the decompiler cannot understand but - do not fret! - there is a simple way around this which requires the ever useful Notepad++.
Now, open it up then load up 'rock001.mdl' and what you'll get is a lovely bunch of seemingly random characters as shown below.
What you need to do is change the 5th character to a comma (,) like so.
TIP: Not all models will have the character '0' for the 5th byte but you still perform the exact same edit.
Save up and you're ready to decompile.
Step 3: Decompile the model
Open up Cannonfodder's MDLDecompiler and you'll be presented with this.
First of all, make sure you untick 'Use Steam File Access...' else you'll most likely get some error message about it being unable to access a Steam app.
It's fairly straightforward what you have to do. Choose where the model file is (rock001.mdl) and choose where you want the decompiled version to go. Once this is done hit the big magic button labeled 'Extract'.
Upon the completion of this process you should end up with the following files in the folder destination you set earlier.
Step 3: Edit the .QC
Open up Notepad++ if you already haven't and open the 'mdldecompiler.qc' file in the folder with the decompiled files and here's what you should see.
If you're not familiar with .QC files then here's a quick run down of the most important properties.
For this tutorial we are simply going to recompile the model with a different name. To do this simply edit '$modelname' to '$modelname "props_recompiled\rock001_recompile.mdl"'.
Write '$staticprop' so that it is registered as a prop_static and heed this warning...
TIP: Recompiled models with $staticprop are always rotated -270 degrees around the Z axis. To fix this add the property '$origin 0 0 0 270' within the QC.
Now you should (hopefully) have something like this.
Save and open up GUIStudioMDL.
Step 4: Recompile the model
First you may notice if you haven't run GUIStudioMDL is this warning.
Do not fear! All you need to do is click 'OK' and when you're in the program go to Config > Set Orange Box Tools Path and point to 'sourcesdk\bin\orangebox\bin' (lots of bin folders as you can see)
Once set up, choose the 'Orange Box' radio button and on the left-side you'll see a drop-down list with all the games you own running the Orangebox engine.
Now, click File and open up the file 'mdldecompiler.qc' found in the folder.
Before you compile go to your 'tf/models/' folder (make one if you don't have one) and create the folder 'props_recompiled'.
With that done and out of the way click the magic button labeled 'Compile' and with any luck it shall start to compile the model. You should end up with the final line saying 'Completed "mdldecompiler.qc'.
Step 5: Checking the result!
Pop on over to your 'tf/models/props_recompiled' folder and you should see the following.
Can it be true? Has it worked? There is only one way to find out. To the Source SDK!
Open up the Model Viewer then load up your new model under 'props_recompiled\rock001_recompile'.
Ta-da! It's complete and by ticking the 'Physics Model' checkbox we can tell that even the collision model is there!
The Process
The process is quite simple. Here's a simple list.
- Extract the model
- Hex edit it
- Decompile it
- Edit it's QC
- Recompile it
- DONE!
So that's the process in it's simplest form.
For this tutorial we will recompile one of the props_mining rocks with a new name.
What you need
Tools
- GCFScape to extract the model's files
- Notepad++ to do some text and hex editing
- MDLDecompiler to decompile the model
- GUIStudioMDL to recompile the model with a fancy GUI
TIP: Place GUIStudioMDL in the 'sourcesdk/bin/orangebox/bin/' folder and MDLDecompiler in the 'sourcesdk/bin/ep1/bin' folder and create shortcuts for both of them on the desktop so they're easier to get to.
Step 1: Extract the model
First off, load up GCFScape then open up 'team fortress 2 content.gcf' which can be found in the 'steam/steamapps/' folder. Then you can navigate to the models using the menu or you could simply search for the model we are looking for. To do this choose Edit > Find then type 'rock001'.
Now you'll have a list of files like so.
You will see a whole bunch of files with the name 'rock001' and all these files are neccesary to successfully recompile it.
Select them all then right-click and choose 'Extract...'/i]. Place them any place you like and that's that!
Step 2: Hex edit the model
Cannonfodder's MDLDecompiler was coded for use with EP1 models but models in the Orangebox engine use a different model version which the decompiler cannot understand but - do not fret! - there is a simple way around this which requires the ever useful Notepad++.
Now, open it up then load up 'rock001.mdl' and what you'll get is a lovely bunch of seemingly random characters as shown below.
What you need to do is change the 5th character to a comma (,) like so.
TIP: Not all models will have the character '0' for the 5th byte but you still perform the exact same edit.
Save up and you're ready to decompile.
Step 3: Decompile the model
Open up Cannonfodder's MDLDecompiler and you'll be presented with this.
First of all, make sure you untick 'Use Steam File Access...' else you'll most likely get some error message about it being unable to access a Steam app.
It's fairly straightforward what you have to do. Choose where the model file is (rock001.mdl) and choose where you want the decompiled version to go. Once this is done hit the big magic button labeled 'Extract'.
Upon the completion of this process you should end up with the following files in the folder destination you set earlier.
Step 3: Edit the .QC
Open up Notepad++ if you already haven't and open the 'mdldecompiler.qc' file in the folder with the decompiled files and here's what you should see.
If you're not familiar with .QC files then here's a quick run down of the most important properties.
- $cd this points to the location of the files to decompile
- $modelname this is the name of the model once it is compiled
- $model 'body this points to the location of the SMD which is the model itself
- $cdmaterials this points to the location of the model's texture(s)
- $sequence this defines the animations of the model and even if is static it will have an 'idle' animation
- $collisionmodel this points to the collision model obviously
- $scale this property can be used to scale models up or down. Useful for recompiling props for skybox usage
- For more commands visit this VDC page.
For this tutorial we are simply going to recompile the model with a different name. To do this simply edit '$modelname' to '$modelname "props_recompiled\rock001_recompile.mdl"'.
Write '$staticprop' so that it is registered as a prop_static and heed this warning...
TIP: Recompiled models with $staticprop are always rotated -270 degrees around the Z axis. To fix this add the property '$origin 0 0 0 270' within the QC.
Now you should (hopefully) have something like this.
Save and open up GUIStudioMDL.
Step 4: Recompile the model
First you may notice if you haven't run GUIStudioMDL is this warning.
Do not fear! All you need to do is click 'OK' and when you're in the program go to Config > Set Orange Box Tools Path and point to 'sourcesdk\bin\orangebox\bin' (lots of bin folders as you can see)
Once set up, choose the 'Orange Box' radio button and on the left-side you'll see a drop-down list with all the games you own running the Orangebox engine.
Now, click File and open up the file 'mdldecompiler.qc' found in the folder.
Before you compile go to your 'tf/models/' folder (make one if you don't have one) and create the folder 'props_recompiled'.
With that done and out of the way click the magic button labeled 'Compile' and with any luck it shall start to compile the model. You should end up with the final line saying 'Completed "mdldecompiler.qc'.
Step 5: Checking the result!
Pop on over to your 'tf/models/props_recompiled' folder and you should see the following.
Can it be true? Has it worked? There is only one way to find out. To the Source SDK!
Open up the Model Viewer then load up your new model under 'props_recompiled\rock001_recompile'.
Ta-da! It's complete and by ticking the 'Physics Model' checkbox we can tell that even the collision model is there!
Last edited: