This is a tutorial on how to get models/textures from a Source Engine game (I assume most Source Engine games pack files like TF2). In this tutorial, I will be using Team Fortress 2. I would like to thank moley @ fpsbanana for some of this tutorial. Please note I have not tested this on a character model since it appears some of the body parts are separated and it's pretty tedious to do.
Requirements:
- Maya 2009 (or whatever)
- Source SDK (free from Steam)
- GCFScape
- VTFEdit
- StudioCompiler
Setting up (one time only) - sorry, no screenshots for this
1. Install the Source SDK, GCFScape, VTFEdit and StudioCompiler (or download the compressed version).
2. Go to <Steam Folder>/SteamApps/<your username>/sourcesdk/maya/4.5/scripts and copy everything into My Documents/maya/scripts (overwrite if necessary).
3. To fix any compatibility problems, go into the smd folder and select smdRead.mel and smdMakeShader.mel. Right-click on one of them and click Properties and uncheck the Read-Only box and click OK.
4. Open smdMakeShader.mel with Notepad/text editor and change this line:
connectAttr -f ($place + ".mirror") ($fileTex + ".mirror");
to this instead:
//connectAttr -f ($place + ".mirror") ($fileTex + ".mirror");
5. Save and close and then open smdRead.mel and change this line:
print system "time";
to this instead:
//print system "time";
6. Save and close.
Extracting GCF Files (and VPK files*)
1. Open GCFScape and click File > Open. Browse to the GCF file you would like to extract from. In this example, I'm using team fortress 2 materials.gcf.
*(note, for games that use the new VPK format such as L4D2 and Portal 2, you choose the VPK which is named pak<number>_dir.vpk)
2. Find the model(s) that you would like to extract. You can normally find models in <game name>/models.
3. Find the model(s) (with the .mdl extension, include any .vtx and .vvd files if they exist) and extract them by right-clicking and clicking on Extract.
4. Now, we will need to find the matching texture file for the model. You can normally find textures in the <game name>/materials folder. Go into the models folder and find the matching .vtf file for the model. (eg. my model was in tf/models/props_gameplay so the texture should be in tf/materials/models/props_gameplay). If only a .vmt file exists for the model, extract it and open it with Notepad++ (or whatever) and look at the texture referenced next to $basetexture and find it.
5. Extract like before and close GCFScape. Open up StudioCompiler (run as admin on Windows 7/Vista) and click on the Model Decompile tab. Browse to the MDL file and choose an output directory.
6. Hit Extract and click OK. If it fails, try ticking Dump Old Unweighted SMD's.
7. Now we've got the models all sorted out. Now we need to convert the VTF files into a format that Maya can understand. Open up VTFEdit and go to File > Open. Browse to the VTF file.
8. Go to File > Export and select .PNG as the save as type (for some reason TGA doesn't work). (If the texture does not look the same or seems like it has something missing, save it as TGA and use a program like Photoshop and save it as a PNG).
9. Open up Maya and click on File > Import SMD. Find the SMD file for your model (normally it's the name of the .mdl file with _reference at the end).
10. Another popup should appear, it's looking for the texture file. Browse to the PNG we created with VTFEdit and wait while Maya renders the vertices.
11. A popup should come up asking what direction you would like the model to be but you can select No Change since it should already be OK for the COD world.
Enjoy, hope this worked for you! The texture for the model should be in Hypershade already.
Requirements:
- Maya 2009 (or whatever)
- Source SDK (free from Steam)
- GCFScape
- VTFEdit
- StudioCompiler
Setting up (one time only) - sorry, no screenshots for this
1. Install the Source SDK, GCFScape, VTFEdit and StudioCompiler (or download the compressed version).
2. Go to <Steam Folder>/SteamApps/<your username>/sourcesdk/maya/4.5/scripts and copy everything into My Documents/maya/scripts (overwrite if necessary).
3. To fix any compatibility problems, go into the smd folder and select smdRead.mel and smdMakeShader.mel. Right-click on one of them and click Properties and uncheck the Read-Only box and click OK.
4. Open smdMakeShader.mel with Notepad/text editor and change this line:
connectAttr -f ($place + ".mirror") ($fileTex + ".mirror");
to this instead:
//connectAttr -f ($place + ".mirror") ($fileTex + ".mirror");
5. Save and close and then open smdRead.mel and change this line:
print system "time";
to this instead:
//print system "time";
6. Save and close.
Extracting GCF Files (and VPK files*)
1. Open GCFScape and click File > Open. Browse to the GCF file you would like to extract from. In this example, I'm using team fortress 2 materials.gcf.
*(note, for games that use the new VPK format such as L4D2 and Portal 2, you choose the VPK which is named pak<number>_dir.vpk)
2. Find the model(s) that you would like to extract. You can normally find models in <game name>/models.
3. Find the model(s) (with the .mdl extension, include any .vtx and .vvd files if they exist) and extract them by right-clicking and clicking on Extract.
4. Now, we will need to find the matching texture file for the model. You can normally find textures in the <game name>/materials folder. Go into the models folder and find the matching .vtf file for the model. (eg. my model was in tf/models/props_gameplay so the texture should be in tf/materials/models/props_gameplay). If only a .vmt file exists for the model, extract it and open it with Notepad++ (or whatever) and look at the texture referenced next to $basetexture and find it.
5. Extract like before and close GCFScape. Open up StudioCompiler (run as admin on Windows 7/Vista) and click on the Model Decompile tab. Browse to the MDL file and choose an output directory.
6. Hit Extract and click OK. If it fails, try ticking Dump Old Unweighted SMD's.
7. Now we've got the models all sorted out. Now we need to convert the VTF files into a format that Maya can understand. Open up VTFEdit and go to File > Open. Browse to the VTF file.
8. Go to File > Export and select .PNG as the save as type (for some reason TGA doesn't work). (If the texture does not look the same or seems like it has something missing, save it as TGA and use a program like Photoshop and save it as a PNG).
9. Open up Maya and click on File > Import SMD. Find the SMD file for your model (normally it's the name of the .mdl file with _reference at the end).
10. Another popup should appear, it's looking for the texture file. Browse to the PNG we created with VTFEdit and wait while Maya renders the vertices.
11. A popup should come up asking what direction you would like the model to be but you can select No Change since it should already be OK for the COD world.
Enjoy, hope this worked for you! The texture for the model should be in Hypershade already.
A casual conversation between barata and I about Nukem.