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

Discussion in 'Tutorials & Resources' started by Psy, Aug 20, 2009.

  1. Seba

    aa Seba DR. BIG FUCKER, PHD

    Messages:
    2,352
    Positive Ratings:
    2,337
    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.
     
  2. Justinger

    Justinger L1: Registered

    Messages:
    2
    Positive Ratings:
    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.

    [​IMG]

    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!
     
  3. Seba

    aa Seba DR. BIG FUCKER, PHD

    Messages:
    2,352
    Positive Ratings:
    2,337
    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.
     
  4. Justinger

    Justinger L1: Registered

    Messages:
    2
    Positive Ratings:
    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
     
  5. X82

    X82 L1: Registered

    Messages:
    2
    Positive Ratings:
    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.
     
  6. TheKieranator

    TheKieranator L6: Sharp Member

    Messages:
    282
    Positive Ratings:
    169
    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?
     
  7. X82

    X82 L1: Registered

    Messages:
    2
    Positive Ratings:
    0
    Make sure you have edited the mdl file to change the IDST0 to IDST,
     
  8. TheKieranator

    TheKieranator L6: Sharp Member

    Messages:
    282
    Positive Ratings:
    169
    I assure you, I did that. Not the first model I've decompiled.
     
  9. honeymustard

    honeymustard L9: Fashionable Member

    Messages:
    698
    Positive Ratings:
    273
    Double check the output folder actually exists. Then check it again. I had this problem yesterday :p
     
    • Thanks Thanks x 1
  10. TheKieranator

    TheKieranator L6: Sharp Member

    Messages:
    282
    Positive Ratings:
    169
    Wow thanks honeymustard! Turns out I forgot to change the output location when I renamed the folders. :O
     
  11. TheKieranator

    TheKieranator L6: Sharp Member

    Messages:
    282
    Positive Ratings:
    169
    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: Aug 7, 2011
  12. Barracuda

    Barracuda L1: Registered

    Messages:
    41
    Positive Ratings:
    36
    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.
     
  13. kitare102

    kitare102 L1: Registered

    Messages:
    1
    Positive Ratings:
    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.
     
  14. Stickynote

    Stickynote L1: Registered

    Messages:
    2
    Positive Ratings:
    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.
     
  15. YM

    aa YM LVL100 YM

    Messages:
    7,101
    Positive Ratings:
    5,732
    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
     
    • Thanks Thanks x 1
  16. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,015
    Positive Ratings:
    3,915
    I have never had that error when working with models, but with Hammer, restarting Steam fixes it
     
  17. Stickynote

    Stickynote L1: Registered

    Messages:
    2
    Positive Ratings:
    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.
     
  18. tyler

    aa tyler snail prince, master of a ruined tower

    Messages:
    5,015
    Positive Ratings:
    3,915
    Dunno what you googled, but if you google the error alone I'm sure you'd see people saying "restart steam".
     
    • Thanks Thanks x 1
  19. ZooL

    ZooL L1: Registered

    Messages:
    32
    Positive Ratings:
    12
    does it work for V_Models too ?? because i want to invert 2 models which have the same anims ...
     
  20. EArkham

    aa EArkham Necromancer

    Messages:
    1,482
    Positive Ratings:
    1,945
    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.