How do I decompile models for use in Blender?

Avatar
DFTBA
31 Posts
Posted Oct 22, 2013
I want to do some editing to some of the game models, and Blender is my 3d editor of choice. I'm willing to use a different one if need be, but that's not the point here.

The Valve MDL files seem to be a compiled version of SMD files, from what google has told me. The only way I've seen to reverse this procedure is to use MDLDecompiler. However, the folder it needs to be placed in does not exist on my system. How can I make the program work? If nothing else, would it be possible for someone who has that folder to run the program and send me the files? I'm trying to get the models for the personality cores.

Advertisement
Registered users don’t see ads! Register now!
Avatar
josepezdj
2,386 Posts
Posted Oct 22, 2013
Replied 2 hours later
Check this tutorial. When you have the .SMD files you can open them in Blender using the Blender SDK Tools
Avatar
DFTBA
31 Posts
Posted Oct 22, 2013
Replied 51 minutes later
Right, but as I said, I don't have the folder that the decompiler needs. The /NAME/sourcesdk folder. I don't have that.
Avatar
Skotty
671 Posts
Posted Oct 22, 2013
Replied 21 minutes later
Download SourceSDK.
Avatar
DFTBA
31 Posts
Posted Oct 22, 2013
Replied 28 minutes later
Yeah, I thought that might be the problem. I did download the SDK when I saw that the folder didn't exist, but it's still not there in the folder. I do not have the /sourcesdk/ folder.
Avatar
Skotty
671 Posts
Posted Oct 22, 2013
Replied 27 minutes later
Have you at least started it once?
Avatar
DFTBA
31 Posts
Posted Oct 22, 2013
Replied 56 minutes later
Yeah, I have. Inside the NAME folder I only have portal and team fortress 2. Those are the 2 folders.
Avatar
josepezdj
2,386 Posts
Posted Oct 22, 2013
Replied 18 minutes later
Did you download the SourceSDK tools or the Portal2 Authoring Tools? because you need the first ones, and when you start them, they should create the required 'sourcesdk' folder:

img

Hmmmm... or will this issue have to do with the steampipe? :rolleyes:

Avatar
DFTBA
31 Posts
Posted Oct 22, 2013
Replied 1 hour later
I already had the portal 2 authoring tools and I just now downloaded the Source SDK.
Avatar
DFTBA
31 Posts
Posted Oct 23, 2013
Replied 1 day later
Okay, so I found a SourceSDK folder in the Steam/SteamApps/common, not in the Steam/SteamApps/NAME. But I still don't have Steam/SteamApps/NAME.
Avatar
Skotty
671 Posts
Posted Oct 23, 2013
Replied 6 minutes later

http://www.erikszeug.de/files/Programmi ... 20Fixed.7z
Take this and be happy.

Avatar
DFTBA
31 Posts
Posted Oct 23, 2013
Replied 19 minutes later
Now the program starts properly, but hitting "Extract" makes it run for a moment, then I get "Half Life2 MDL Decompiler has stopped working". The files do not appear at the destination.
Avatar
FelixGriffin
2,680 Posts
Posted Oct 23, 2013
Replied 23 minutes later
Which model did you try to decompile? It's to be expected that the decompiler will crash like that, but usually it will spit out a few of the files before dying.
Avatar
Skotty
671 Posts
Posted Oct 24, 2013
Replied 15 hours later
If you forgot the .mdl extension or are using an output directory that does not exist, it crashes.
Avatar
DFTBA
31 Posts
Posted Oct 24, 2013
Replied 40 minutes later
Alright everyone, all your help was able to get me a model file that opens in Blender. However, the whole thing is grey. I know I need to apply the texture file to it. How do I do that? What I mean is, where are the files for the textures on models?
Avatar
Gemarakup
1,183 Posts
Posted Oct 24, 2013
Replied 1 hour later
The VTFs and the VMT's are the textures for the model, but I don't think you apply them in the modeling application, I think that somehow the model gives you information about the scale of the texture.
Avatar
Skotty
671 Posts
Posted Oct 24, 2013
Replied 44 minutes later
Model textures are in Portal 2's VPK files. To open them, download GCF Scape. Use portal2_dir.vpk to open the game's content. To get a .TGA file from the .VTF files, you need VTF Edit.
Avatar
DFTBA
31 Posts
Posted Oct 24, 2013
Replied 1 hour later
Yeah, I found the vpk files and stuff. That's how I got the original mdl. But, within that file in GCFScape, where in the folders are the files relating to the model textures?
Avatar
TeamSpen210
608 Posts
Posted Oct 24, 2013
Replied 1 hour later
materials/models/. The model viewer (not the one inside hammer) will list all the textures associated with a model.
Advertisement
Registered users don’t see ads! Register now!
Avatar
HMW
806 Posts
Posted Oct 24, 2013
Replied 21 minutes later
Edit: I had typed up a convoluted process here for getting the full paths of the materials, but that's actually much simpler... I totally forgot you could see this in the model viewer :smile:

Anyway, once you know where the materials are, open the Portal VPK file and look for a .VMT file with that name. It is a text file that describes the material and it will have one or more lines referring to yet another set of files of the type .VTF. Those are the actual textures, which you can open with VTFEdit and extract the image file (PNG or TGA, likely) for use in Blender.

To make this texture show up on the model in Blender:
make sure you have a 3D panel and an image/UV panel open. Switch to edit mode in the 3D panel and select everything. In the UV panel select everything again and click on "image => open image" from the menu. Select your extracted PNG or TGA image in the file browser to associate it with all faces on the model.