Erik's Zeug

This Tutorial is Obsolete!

Instead of using the old and buggy MDL Decompiler, use Crowbar instead. It gets updated frequently and supports all current Source model formats.

Portal 2 - Decompiling Models

Because Portal 2 uses a newer version of models than current decompilers can handle, here are information how make models decompileable.

To get the model files you need, extract them from Steam\steamapps\common\portal 2\portal2\pak01_dir.vpk using GCF Scape.

The Model Decompiler

Download MDL Decompiler (Fixed Version).

Missing Model File

Now you have a decompiler for models, but it still won't work for some of Portal 2's models (i.e. the cube (metal_box.mdl)).

The older model formats have files called modelname.dx80.vtx. In Portal 2, these don't exist anymore.
But because the decompiler needs them, you have to use a trick here.

To create the missing .dx80.vtx file, just copy the normal .vtx file of your model and rename it to modelname.dx80.vtx. This was the first step.

Changing Version Number

New model version means another version information inside of the .mdl file itself. Now you need a hex-editor of your choice (i.e. XVI32).
Open the modelname.mdl file with the hex editor and change IDST1 at the very beginning of the file to IDST0. This is a version number the model decompiler can work with.

Now just select that file with the model decompiler and it should work.
Have fun manipulating Portal 2 models!
Note: Animated props (i.e. the incenerator hatch) will screw some joints up and probably crash your decompiler, but the reference SMD will be generated.

Models Using Other Models

Especially player models use other, so called animation models as their animation source.
If you want to decompile a model linking to another model, you also have to change the version number of that animation model.
To find out what and where this animation model file is, you have to search with the hex editor in your main model's file for ani or animation.

For example:
models\player\ballbot\ballbot.mdl links to models\ballbot_animations.mdl.
Both files need IDST0 instead of IDST1, because both files will be decompiled.

Last Update: 2015-01-07