This tutorial will explain how to edit or replace models for Insurgency using Blender.
In general, the process for importing into Insurgency is the same as for most Source engine games. However, because Insurgency uses a new-ish feature of the Source model format that most decompilers don't know how to deal with yet, recompiled models tend to have problems with their animations. To deal with that, instead of re-compiling our decompiled animations, we instead borrow the animations from the original, undecompiled file.
What this means, essentially, is that we have to fiddle with some boring text files before hitting the go button.
Before we start, we'll need some important files and programs.
To extract the files we want to replace, we'll need GCFScape.
To decompile those extracted files, we'll need Crowbar.
To edit the necessary files, we'll need a decent text editor, like Notepad++.
To export and compile our edited model, we'll need the Blender Source Tools.
We'll also need certain important files:
Editing text files
At this point we are ready to set up the files we need to recompile our model.
Copy over the bonemerges.qci, compile.bat and compile.qc files.
bonemerges.qci doesn't need editing, but we need to edit the name of our decompiled .qc file into compile.bat.
We should also make sure the folder structure matches.
Once that's done, we can simply double click compile.bat to run it, and generate the 'definebones.qci' file.
'definebones.qci' will contain a bunch of junk we don't need at the start of the file. Go ahead and delete everything before the first '$definebone' line.
Now we edit our compile.qc. This is the qc we will use to compile our edited model.
We need to change a few lines. I've edited the file into what should be an easy to understand template. Several of the details will be found in the original v_m45.qc file.
With that done, we don't need to edit any more text files.
Editing the model
Now that's out the way, we can make our changes to the model.
Here, I have the model I want to replace the pistol with.
We need to import the file we want to replace.
Go to File > Import > Source Engine, then select the v_m45.qc. This will import the model, its skeleton, and the animations automatically.
We need to scale our model appropriately, assign the correct vertex groups, and set the correct model and material names.
Our model is a little longer, so the silencer won't look right. But you don't need to silence a lightgun, do you? At least the handle is about right.
The next step is to assign the correct vertex groups. The quickest way to do this is to duplicate the original pistol mesh, move it out the way, and combine it with your new model. To make sorting through all the vertex groups a little easier, you can remove all the unused vertex groups using this script.
Because the model we are using doesn't really have any moving parts, it's a pretty easy job. All we have to assign is the trigger and some batteries pretending to be a magazine, with the rest all assigned to the 'Weapon' group.
With that done, we can add an armature modifier to our model and preview the animations. If all our groups are assigned correctly, it should all work.
Next, we need to make sure the name of the model matches what we put in the .qc before.
Also make sure that you have applied the Location of the model, so that it's origin is at 0,0,0. Otherwise, we will get funny results later on. You can do this with Ctrl-A in Object Mode.
We also need to give the material a good name- that will be the name of the .vmt file that controls the material later on.
Almost there. All we need to do is compile the model. We did the hard work earlier, so there are just a few settings to change.
The export path should be the path all the rest of our files are- the original .qc, .smd files etc. The 'Engine Path' is
X:\Steam\steamapps\common\insurgency2\bin\ and the 'Game Path' is
X:\Steam\steamapps\common\insurgency2\insurgency\, where X is the correct drive on your computer. Finally, the QC path is our compile.qc file.
With those set, we can hit Export > NesZapper.smd. Because we are using the animations from the original file, we don't actually need to export the animations. Although you can if you really want.
If you get an error message, open the Blender console for more information. It's under Window > Toggle System Console.
If all is well, we can compile the model. Hit 'compile.qc' down the bottom.
With that done, we should now find a folder called 'models' inside
However, they're not much good there. We need to move them into the custom folder, inside their own folder. You can call it whatever you like.
Remember we were going to borrow the animations from the original file? Time for that. Rename the original .mdl we got out of GCFScape to 'v_m45_anims.mdl'. That's what we put in the '$includemodel' line of the .qc. Then we need to copy it alongside our exported model.
At this point, our model is done, and you can preview it in the Half Life Model Viewer (theres a handy dandy link inside the blender source tools panel) or simply ingame.
It worked! Well at least the model did- we haven't sorted the material out yet.
We need to create a .vmt file with the right name and the right location. The name is easy- it's what we called the material in blender. 'neszapper.vmt' it is then. As for the location, we already set that in the .qc file. "$cdmaterials "models\weapons\neszapper\" means it needs to go in
Edit your .vmt to your liking. This is a good reference, but the easy way is to copy one from another model and just change the filenames.
You'll also need to put your textures in as .vtf files. These can be created using VTFEdit, or using the Photoshop or Gimp plugins.
Common Problems and Notes
If the model you are replacing does not use animations, for example sights and other attachments, you don't need to bother with all those text files- just compile the same as you would for any other source engine game. You can still do it this way if you want- it's just unneccessary.