Decompiling Source MDL files to SMD format allows them to be imported into a program such as 3DS Max.
- Find the model you want to decompile. You can use the SDK Model Viewer for this, but I recommend using the model browser inside of Hammer (this has a search ability).
- Extract all the related files for the model (*.mdl, *.vtx, etc) from the game package (example: team fortress 2 content.gcf) to a new directory using GCFScape.
– Make sure you are using “substring search“.
- Copy the toolbox folder to the new directory.
- Run decompile_source_models.bat.
– During the conversion MDLDecompiler will open. Select the file listed in the command window and decompile. Close MDLDecompiler when done to continue the conversion.
- During the conversion VTFEdit will open so you can batch convert any VTF textures. This step is optional. Simply close VTFEdit if you wish to skip it.
- You now have an SMD file that can be imported into 3D Studio Max.
– Note: Any textures will need to be manually reapplied.
Decompiling Animations
Animations can be decompiled in the same manner as models.
- Extract the animation .mdl and the .ani that goes with it (if there is one) (ex: Alyx_animations.mdl and Alyx_animations.ani).
- Use MDLDecompiler to decompile.
- Import the animation .smd file into 3D Studio Max (you will need to have the reference .smd model already open).
– The animations for games made after Episode 1 don’t decompile very well. Some TF2 animations will work. Left 4 Dead animations won’t decompile at all.
Old Manual Method
- Find the model you want to decompile. You can use the SDK Model Viewer for this, but I recommend using the model browser inside of Hammer (this has a search ability). [Pic]
- Extract all the related files for the model (*.mdl, *.vtx, etc) from the game package (example: team fortress 2 content.gcf) using GCFScape. [Pic]
- Open the .mdl file with a Hex Editor and change the first 5 characters so it reads “IDST,”. [Pic]
- Use MDLDecompiler to decompile the model. [Pic]
– If using Left 4 Dead models, you will need to copy the .vtx file twice and rename the extensions to .dx80.vtx and .dx90.vtx before decompiling.- You now have an SMD file that can be imported into 3D Studio Max. [Pic]
Textures
Extract the textures using GCFScape.
- The textures will be in VTF format and should be converted to TGA, this can be done from within VTFEdit.
- The material names can be found by opening the .mdl file with MDLTextureInfo.exe.
- The materials may be in a separate package (ex: team fortress 2 materials.gcf)
- VTFEdit has the ability to batch convert texture directories. Go to Tools -> Convert Folder.
Related Tools
- 3D Studio Max VTF Texture Plug-in – Allows you to use VTF textures in 3DS Max.
- MDL Texture Info – A small console app that will tell you the textures used by a MDL file. [Download]
- GCFScape – A tool for browsing and extracting from Valve package files (GCF, VPK, etc) [Download]
- Hex Editor – A basic hex editor for modifying MDL files so they can be decompiled without errors. [Download]
- MDLDecompiler – A tool to decompile MDL files to SMD format. [Download]
- Fix L4D Files – A small batch script to fix L4D/L4D2 files so they can be decompiled.
Problems and fixes
- The textures on decompiled characters look warped.
- I tried decompiling weapons, but they don’t look right.
- Many Source games have several models for a single weapon. These may include w_models (worldmodels), v_models (viewmodels), and c_models (a combination of w_models and v_models.). Generally you want to decompile the w_model, as this is the third person model and won’t have missing sides.