[Tutorial] The complete guide to decompiling and recompiling models!

Bob Ross

L3: Member
Jun 16, 2009
105
9
im trying to make team-specific skins for the DH but obviously theres only one model. will this let me have team specific weapon models?
 

Psy

The Imp Queen
aa
Apr 9, 2008
1,706
1,491
I think it's possible. You'd have to look at the QC files for weapons with team-specific skins such as the Blutsauger.
 

Drick96

L1: Registered
Jul 18, 2010
4
0
I'm trying to make a seemingly simple little mod. What it is isn't really that important, but it will never work unless I can get the model I decompiled to recompile properly.

I decompiled engineer_animations.mdl (the one in the same folder as engineer_arms.mdl, in c_items), I didn't make ANY modifications but recompiling got me some error about not being able to find the bone "bip_hand_R".

So, according to something I saw someplace else, I added
$bonemerge "bip_hand_R"
$bonemerge "bip_hand_L"
Right after $modelname in mdldecompiler.qc.

The model recompiled successfully. However... In-game all of the engineer's viewmodels are invisible (except, strangely, the wrench.) also, when I reload with the pistol it pops up on the bottom of the screen, still a little messed up however.

Also, I checked back in GUIstudioMDL, and there were some warnings I didnt notice before when recompiling:

"WARNING: *animation name* : bounding box out of range : -131024 -130533 -114643 : -9999 -9999 -9999"

It does this for EVERY file that is included in the recompile.

I can probably get my little experiment to work if I can just recompile this properly without any modifications, so if you can help then I'd appreciate it.



(Also, when I decompiled engineer_animations.mdl I got this error, even though it still went through:
"Hacked EXE! Vphysics.dll won't be loaded (stops crashes)"
Since I'm dealing with the engineer's viewmodel hands I wouldn't think that physics matter, so I didn't think much of it. Also, I'm using a hacked version of mdldecompiler specifically for TF2 because the regular one doesn't seem to ever load this file in particular. (I've loaded different models with it))
 

Drick96

L1: Registered
Jul 18, 2010
4
0
Oh pfft *taps head* with all the experimenting I forgot the simple step of changing that 0 to a ,

Okay, I did that. Now the original Mdldecompilier works but crashes after it seems to finish. All the files are there It doesnt seem to finish the .qc however because it appears that line 101 is missing or corrupt or something, so it won't recompile.
Now, using the hacked version again, it doesn't even get THAT far. it makes a lone .qc that turns out to be blank then crashes.

So it seems adding the comma broke it even more :/

Also, mdldecompilier (original) and the hacked version are both in "source sdk base/bin" because in "source sdk/bin" and "source sdk/bin/orange box/bin" I get that Q appendslash or whatever error. GUIStudioMDL is in "Source sdk/bin".
 
Feb 18, 2009
640
629
I have it in "sourcesdk\bin\ep1\bin" (then shortcut it to desktop) and that works fine. The only thing with it is, it occasionally crashes when trying to decompile a model for the first time (ie, just after you selected a new/different model), but just open it up again and it should work. If that doesn't work, try "reinstalling" it.

EDIT: This
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. ;)
 
Last edited:

Drick96

L1: Registered
Jul 18, 2010
4
0
Okay, I re-downloaded mdldecompiler, put it in the ep1 bin, re-extracted engineer_animations.mdl, hex-edited it from "IDST0" to "IDST,", and it still crashes. It seems that everything comes out okay except for the .qc which is missing about 20 lines compared to the decompile of "IDST0" with the hacked version. I tred splicing in the missing lines to the "IDST," version from the "IDST0" version. When I try to recompile that one I still get the ERROR: cannot find bone bip_hand_R for bbox. I put those Bonemerges in again and the WARNINGS come again. I just came full circle :(
 

Drick96

L1: Registered
Jul 18, 2010
4
0
I think I've got it almost figured out. A tutorial helped me fix the bounding box error, but the viewmodels are twisted wrong. I might be able to fix it though.

EDIT: I've got it ^^ sorry for wasting space on this thread. Also thanks Mick for trying to help :)
 
Last edited:

Bad Vlad

L2: Junior Member
May 23, 2010
71
16
im trying to make team-specific skins for the DH but obviously theres only one model. will this let me have team specific weapon models?

You can have team-specific skins, but you'll need to recompile the model and make that a part of your skin. The skins are referred to within the model, apparantly.
 

n30n

L4: Comfortable Member
Jul 13, 2009
154
14
Ive been wondering how to make 2d model part show backside in game. Im using 3ds max
 

grazr

Old Man Mutant Ninja Turtle
aa
Mar 4, 2008
5,441
3,814
I seem to get "Extra App ID set to 211, but no steamappid" when opening the decompiler.

Google just throws up 5 year old threads about the beta SDK. The first solution was to edit my gameconfig file, but this in turn breaks other SDK features including the model viewer. Further searching revealed this thread which states the program is simply out dated since the last SDK beta went official. The solution is supposedly: This; which you've already linked... for another process (it does both???).

but i was wondering since i havn't seen this complaint made here yet if the program should work.

I'm using version 0.5
 
Last edited:

Rexy

The Kwisatz Haderach
aa
Dec 22, 2008
1,798
2,533
I seem to get "Extra App ID set to 211, but no steamappid" when opening the decompiler.

Google just throws up 5 year old threads about the beta SDK. The first solution was to edit my gameconfig file, but this in turn breaks other SDK features including the model viewer. Further searching revealed this thread which states the program is simply out dated since the last SDK beta went official. The solution is supposedly: This; which you've already linked... for another process (it does both???).

but i was wondering since i havn't seen this complaint made here yet if the program should work.

I'm using version 0.5

I say to everyone who asks me about decompiling to forget all the complications and just use crafty, which will spit out .obj, tga, and vmts of anything you need. The downside is you don't get the .qc, but if you're intending to recompile anyway, chances are you can just as easily write or edit one of your existing qc files. The other downside is you'll miss out on any sequences the model has, but for static props, I don't see the need to get any more complicated. Just my 2 cents on re-appropriation of existing assets.
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
I say to everyone who asks me about decompiling to forget all the complications and just use crafty, which will spit out .obj, tga, and vmts of anything you need.

Hrm, does Crafty work on models with foreign characters in the name?

Had a project a couple of weeks ago I took over, but the models needed some corrections... unfortunately I couldn't decompile them due to foreign characters causing MDLDecompiler to throw up.

Kep
 

Tapp

L10: Glamorous Member
Jan 26, 2009
776
215
A word of warning, if GUIstudioMDL stops working, you need to refresh SDK content. I spent about a day trying to fix that one.
 

Rexy

The Kwisatz Haderach
aa
Dec 22, 2008
1,798
2,533
Hrm, does Crafty work on models with foreign characters in the name?

Had a project a couple of weeks ago I took over, but the models needed some corrections... unfortunately I couldn't decompile them due to foreign characters causing MDLDecompiler to throw up.

Kep

Um, it might, there's only one way to find out.
 

Terr

Cranky Coder
aa
Jul 31, 2009
1,590
410
So what's going on when it comes to MDLs here? It seems like there are two or three tools and some are abandoned, or only do a certain part, etc...?
 

battlebottle

L1: Registered
Dec 22, 2010
1
0
Hi,

I'm new to this moding stuff, but lately I've been trying hard to make my own custom tf2 animations for the game. I'm basically trying to reproduce what's done in this tutorial here: http://www.youtube.com/watch?v=PoBAWUoYr0o .

I've been having a lot of trouble with it. I can decompile and animate the player models just fine, but I can't get them to recompile under any circumstances. I've tried following the tutorial in this thread to decompile and recompile a player model but I run into errors. I can't find many tutorials out there on how to do this stuff beyond the video linked above. Perhaps there's a large body of information out there about this stuff I've missed somehow.

Here's my effort of trying to decompile and recompile a model, I am pretty much completely out of ideas as regards what i should do next to work around this:
http://www.youtube.com/watch?v=9iJOc7eXHiQ


If anyone has any ideas at all what i should do or where i can go to read more relevant totorials I'd greatly appreciate it.

cheers
 

Dogmeat

L1: Registered
Sep 8, 2009
10
1
Hey Bottle, also trying to get something into source, not sure how much i can help. i went through this tut his example QC file seemed to work better than others iv found, finally starting to understand what most of it means in them, i find that most peoples problems start with having all the file in the write places.

The one question id like to ask anyone is where is the VMT referenced? is it in the smd? or the mdl? because the QC file only refernces the directory to the materials where can i look to see what exact VMT the compile is looking for? because right now im getting a purple and black checkered model with a warning that the model can find one or more VMT's, so i want to know where its looking. thanks in advance, MERRY CHRISTMAS
 

TheKieranator

L6: Sharp Member
Mar 6, 2011
282
213
First of all, thank you for this guide Psy, it's a great help.
I seem to be going fine up to the recompile stage, where I get the following output after clicking 'Compile':
_________________________________________________________________________
Loaded QC file - "C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled\mdldecompiler.qc"

Created command line: "C:\Program Files\Steam\steamapps\kieranatork82\sourcesdk\bin\orangebox\bin\studiomdl.exe" -game "c:\program files\steam\steamapps\kieranatork82\team fortress 2\tf" -nop4 -nox360 "C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled\mdldecompiler.qc"

qdir: "c:\program files\steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled\"
gamedir: "c:\program files\steam\steamapps\kieranatork82\team fortress 2\tf\"
g_path: "C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled\mdldecompiler.qc"
Building binary model files...
Working on "mdldecompiler.qc"
SMD MODEL C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled/control_room_console01_reference.smd
SMD MODEL C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled/lod1_control_room_console01_reference.smd
SMD MODEL C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled/idle.smd
SMD MODEL C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled/phymodel.smd
Lod 1: vertexes: 3088 (56 new)
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model7¼`y}Y@ has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 7¼`y}Y@inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Model has 2-dimensional geometry (less than 0.500 inches thick on any axis)!!!
WARNING: Error with convex elements of C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\custom\props_spytech_tri\decompiled/phymodel.smd, building single convex!!!!
Mod7¼`y}Y@el has 1 convex sub-parts
Collision model completed.
---------------------
writing c:\program files\steam\steamapps\kieranatork82\team fortress 2\tf\models/props_spytech_tri\control_room_console01_tri.mdl:
Error opening c:\program files\steam\steamapps\kieranatork82\team fortress 2\tf\models/props_spytech_tri\control_room_console01_tri.mdl! (Check for write enable)
_________________________________________________________________________

Basically, what I've been trying to do is add a grey/neutral skin option to the spytech computers; this is the first attempt. I did nothing (too much) out of the ordinary, and this happens. I may not have put the props_recompiled folder in the right place:
C:\Program Files\Steam\steamapps\kieranatork82\team fortress 2\tf\models\props_recompiled
Some guidance would be great; I've still got all the other models to modify! D: