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

Seba

DR. BIG FUCKER, PHD
aa
Jun 9, 2009
2,364
2,728
Your .qc is named 'md ldecompiler'; the space might cause problems. You might want to rename it to the model name, it makes keeping track of .qc's much easier (also, renaming the .smd's appropriately will help greatly in the future, you won't have a bunch of idle.smd's). As for the 2D geometry errors, those occur because your collision mesh doesn't have all faces in one smoothing group. Fix that. The very last lines are telling you that you don't have a props_spytech_tri folder in tf/models. Make one.
 

Justinger

L1: Registered
Jul 10, 2011
2
0
recompile error

Thanks for the tutorial. It was very helpful. However, when I recompile my model some of my animations are broken. I believe some of the bones are messing up and flying away. Any idea what may be causing this? I've followed all of the other steps and they seem to work fine (as far as I can tell). The issue may lie somewhere in the compile, or maybe the animation files that are extracted... I'm not sure. If anyone has their own copy of a decompiled scout bat with smd's and qc files I think that would go a long ways towards troubleshooting this.

scout_recompile_broken_bones.JPG


Any help would be great. I haven't been able to find other people with this issue.

Here are the contents of my qc file just in case:

$cd "C:\TF2_Work\decompiled\bat"
$modelname "weapons\v_models\v_bat_scoutC.mdl"
$model "v_bat" "v_bat_scout.dmx.smd"
$cdmaterials ""
$hboxset "default"
$hbox 0 "bip_lowerArm_R" -2.130 -5.350 -5.070 1.780 12.260 2.870
$hbox 0 "bip_hand_R" -1.380 -0.490 -2.280 3.000 7.600 4.510
$hbox 0 "weapon_bone" -1.720 -2.610 -1.810 2.060 27.360 1.980
// Model uses material "models/player/scout/scout_hands.vmt"
// Model uses material "models/weapons/v_bat/v_bat.vmt"
$attachment "weapon_bone" "weapon_bone" 0.00 0.00 -0.00 rotate -0.00 0.00 0.00
$surfaceprop "default"
$illumposition 24.012 -8.000 -8.779
$sequence idle "idle" loop ACT_VM_IDLE 1 fps 30.00 node raised
$sequence draw "draw" ACT_VM_DRAW 1 fps 30.00 node raised {
{ event 5004 1 "Weapon_Bat.Draw" }
{ event 5004 8 "Weapon_Bat.DrawSwoosh2" }
{ event 5004 16 "Weapon_Bat.DrawSwoosh1" }
{ event 5004 20 "Weapon_Bat.DrawCatch" }
}

$sequence swingMiss_a "swingMiss_a" ACT_VM_HITCENTER 2 fps 30.00
$sequence swingMiss_b "swingMiss_b" ACT_VM_HITCENTER 1 fps 30.00
$sequence swingMiss_crit "swingMiss_crit" ACT_VM_SWINGHARD 1 fps 30.00 node raised
$sequence holster_idle "holster_idle" loop ACT_VM_IDLE_LOWERED 1 fps 30.00 node lowered
$sequence holster "holster" ACT_IDLE_TO_LOWERED 1 fps 30.00 transition raised lowered
$sequence unholster "unholster" ACT_VM_LOWERED_TO_IDLE 1 fps 30.00 transition lowered raised


Thanks!
 

Seba

DR. BIG FUCKER, PHD
aa
Jun 9, 2009
2,364
2,728
You seem to be having some bone complications, judging by the picture. This is probably caused by the .qc spit out by what I assume is MDLDecompiler. The .qc's created by that are usually vague and lack some parameters that are necessary for the model to work properly. Assuming that you're trying to make a reskin of the bat, you should use the c_bat.mdl file, located under weapons/c_weapons. The c_ models are used for both viewmodels and world models, where v_ and w_ models were used before, respectively.
 

Justinger

L1: Registered
Jul 10, 2011
2
0
Resolved the issue

I found this tutorial that mentions broken animations from the decompile.

http://www.gamebanana.com/tuts/7316

It appears that the decompiler doesn't always get the animations right. With the fix in this tutorial, I was able to use the animations from the original model. Has anyone found why the animations are broken? Is there a way to really get those animations exported, or is this just a fact of life?

My changed .qc looks like this:

$cd "C:\TF2_Work\decompiled\bat"
$modelname "weapons\v_models\v_bat_scoutC.mdl"
$includemodel "weapons\v_models\v_bat_scout.mdl"
$model "v_bat" "v_bat_scout.dmx.smd"
$cdmaterials ""
$hboxset "default"
$hbox 0 "bip_lowerArm_R" -2.130 -5.350 -5.070 1.780 12.260 2.870
$hbox 0 "bip_hand_R" -1.380 -0.490 -2.280 3.000 7.600 4.510
$hbox 0 "weapon_bone" -1.720 -2.610 -1.810 2.060 27.360 1.980
// Model uses material "models/player/scout/scout_hands.vmt"
// Model uses material "models/weapons/v_bat/v_bat.vmt"
$attachment "weapon_bone" "weapon_bone" 0.00 0.00 -0.00 rotate -0.00 0.00 0.00
$surfaceprop "default"
$illumposition 24.012 -8.000 -8.779
 

X82

L1: Registered
Jul 29, 2011
2
0
I just had to reply to ask the same question.
I would love a way of using the official animations, but they always break.

Just for clarification I will highlight why they break.

If you open any animation smd file you will notice the bone names, the frame time and their position.
However, some of the bones positions are stupidly off.

This line is normal:

Code:
1 -2.131430 -5.805748 -7.194578 0.408836 0.307714 1.318698

However, on some bones the decompiling process causes chaos. Here is another bone further down in the file:

Code:
45 1.681065 6.576639 0.639780 -3.120969 1.147131 2.739852
 46 0.000004 3.781069 0.000034 0.603212 0.000000 0.000000
 47 0.000012 [B][SIZE="4"][COLOR="Red"]1488.398411[/COLOR][/SIZE][/B] 0.000011 0.293674 0.000000 0.000000
 48 2.639748 6.552763 2.641620 2.962796 1.017620 2.439658

As you can see, the bold bit is creating havok when importing. The solution is a long winded one.
Its possible (I have done it) to edit these really high numbers to something more reasonable. The animation isnt 100% perfect, but it does the job.

I really hope a solution can come out of this since I want to tweak the original animations since I suck at animating, period.
 

TheKieranator

L6: Sharp Member
Mar 6, 2011
282
213
Just a quick problem:

I'm trying to decompile the Teleporter, but MDLDecompiler gives me the following messages:

Loaded model C:\...\input\teleporter.mdl
Error opening C:\...\output\teleporter_reference.dmx.smd

Obviously, the files I'm decompiling are in the 'input' folder, and the output location is the 'output' folder. I grabbed all the files related to the teleporter model in the GCF. What is going on?
 

honeymustard

L9: Fashionable Member
Oct 26, 2009
698
573
Just a quick problem:

I'm trying to decompile the Teleporter, but MDLDecompiler gives me the following messages:

Loaded model C:\...\input\teleporter.mdl
Error opening C:\...\output\teleporter_reference.dmx.smd

Obviously, the files I'm decompiling are in the 'input' folder, and the output location is the 'output' folder. I grabbed all the files related to the teleporter model in the GCF. What is going on?

Double check the output folder actually exists. Then check it again. I had this problem yesterday :p
 

TheKieranator

L6: Sharp Member
Mar 6, 2011
282
213
Double post, but I need help before AF3/4 is due! :O

My GUIStudioMDL keeps crashing when I click compile after loading a QC. It's not just this QC either, but any other I load up. What do I do?

EDIT: The problem was solved by the helpful people in chat. Somehow I forgot that you need the SDK open.
 
Last edited:

Barracuda

L1: Registered
Sep 24, 2009
41
37
Sigh... the situation with MDLDecompiler is pretty much the same as with VMEX... it's outdated, full of bugs but still the only usable tool of its kind. And, of course: it's closed-source so you can't just go ahead and make it better.
 

kitare102

L1: Registered
Oct 1, 2011
1
0
Things have worked perfectly until I tried to use GUIStudioMDL. Whenever I try to give it the right path, it just says the either studiomdl.(what ever the end is) or gameconfig.txt is not there.
 

Stickynote

L1: Registered
Jul 3, 2012
2
0
Ok here's the issue. I have gone through every help forum that I can find, but none of the fixes work.
I don't have the orangebox package, all I have is TF2.
This is probably a issue you have seen before, when I try to compile my files I get this error.

SteamStartup() failed: SteamStartup(0xf,0x0018F170) failed with error 1: failed to take master pipe connection lock

When I did a few fixes it came up with this...

SteamStartup() failed: SteamStartup(0xf,0x0018F170) failed with error 1: Failed create pipe: 6, Win32 Error 6 "The handle is invalid."

Then back to the first one...

I'm really losing my little 13 year old head about now and I just really need some help, OR if there is anything that does it automatically, because if I see one more error, I think i'm going to smash my computer against the wall.
 

YM

LVL100 YM
aa
Dec 5, 2007
7,135
6,056
Pipelock is some crap steam does every now and then, you need to restart steam to get rid of it. As soon as it comes back, close all steam programs and restart steam.

We all suffer it, it's crap but at least it only takes a quick restart to fix
 

tyler

aa
Sep 11, 2013
5,102
4,621
I have never had that error when working with models, but with Hammer, restarting Steam fixes it
 

Stickynote

L1: Registered
Jul 3, 2012
2
0
Wow, that really worked didn't it? Jeez I go over a million tutorials about the net and nothing gives the simple RESTART STEAM! Lol, shows what they know.
 

tyler

aa
Sep 11, 2013
5,102
4,621
Dunno what you googled, but if you google the error alone I'm sure you'd see people saying "restart steam".
 

ZooL

L1: Registered
Dec 30, 2011
32
13
does it work for V_Models too ?? because i want to invert 2 models which have the same anims ...
 

EArkham

Necromancer
aa
Aug 14, 2009
1,625
2,773
does it work for V_Models too ?? because i want to invert 2 models which have the same anims ...

You won't be able to flip a model with animations because the weightmap won't flip when you flip the mesh. You'd end up with something that looks like it's from The Thing.

You'd have to do more work in your modeling program and probably have to reassign/repaint the entire weightmap. You might get lucky and be able to use whatever mirror weightmap option your program has.

Also, bit of warning, but if you're using XSI Mod Tool, that will NEVER import smd weightmaps that assign more than one bone properly (due to an incorrect ordering sequence in the importer) but Max will. Dunno about Blender. Factor in that sometimes the decompiler will mess up animations and you're better off doing anything animated from scratch in your modeling program.