Model Decompile Script

As a side project of mine I had been trying to create a model decompiler in PHP. After figuring out how to extract some data from the MDL file I thought that I could expand upon this and see if it can go further and do more.

I’ve got to point where it’ll create an SMD reference file and a partial QC. However, upon realizing how much more work is going to be needed to get it to read the files properly I’ve decided to stop working on it and release what I have as it may help someone else interested in trying to read the format and will be more useful that rotting on the HDD. I may go back and try to carry on but getting it to decompile the more complex models properly (NPCs with many submodels, subparts, etc) is just crazy due to amount data. LoD as another layer of complexity also. Being that a working decompiler already exists also contributes to the fact there’s no need to carry on.

This script will currently: Decompile a models reference mesh with bones, weighting, UVW and smoothing; Reconstruct a partial QC. Models with LoD will decompile but the data will be garbage. Some models won’t work altogether (ones with bodygroups or submodels and will cause a memory overflow due to an unbreakable loop.

I haven’t looked and collision meshes so it won’t do anything with those. The script needs to be hosted on a server running PHP 5.2.6 or later but it may work on a older version too. The server also must be running on Linux. It works by the user zipping up the model files (it needs *.mdl, *.vvd and *.dx90.vtx) and uploading them on the index.html page. If it worked you’ll get a text box containing the QC. The SMD files will be in a folder called ‘models’ on your webspace.

This script will also decompile the older HL2 models (v37) with some modifications. I’ve decompile a few successfully as a test but the amount of changes needed doesn’t make it really worth it.

Only people with programming/scripting knowledge are going to find this useful in some way.

http://www.hamaloo.co.uk/dl.php?f=mdlunpack001.zip

Sounds cool, thanks.