This article relates to the game "Half-Life: Alyx". Click here for more information.
This article relates to the workshop tools for "Half-Life: Alyx". Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Importing Source 1 Models

From Valve Developer Community
Jump to: navigation, search
Русский 简体中文

Source 2 has a built-in system for taking old .mdl files from Source 1 and converting them to Source 2. You can utilize this to convert files you don't have the sources to, but there are some issues.

Note:Models that use flexes, such as character models, need extra work to make functional in Source 2, and will in most cases require having the sources of those files.

Prerequisites

This system is very picky as to what kind of .mdl formats are imported. Currently, Source Filmmaker so far has been the most successful place to port models from, which can be beneficial as the SFM already ships with content from a ton of games. However, Half-Life 2 and Left 4 Dead 2, among others, have all been tested and are incompatible, but luckily, Valve has already ported a lot of content from those games.

To do: This may just have something to do with headers, which are easily modifiable. Please do more testing to determine which branches are the most stable.

Creating the .vmdl File

To convert the .mdl file, you must first create a structure for your content to live in. Let's say I'm converting a model from Half-Life 2, lets say "models/humans/group01/male_07.mdl" for use in Half-Life: Alyx. To do this, you will need to have the tools installed and a content folder for the mod you're attempting to compile for. In this case, I have a mod called hl2 which has a corresponding folder in my content and game folders inside of "steamapps/common/Half-Life Alyx".

Next, you'll want to drop your .mdl and it's corresponding files into the same file structure it had in Source 1. So for instance, my male_07 model files will now be in "Half-Life Alyx/content/hl2/models/humans/group01/male_07.mdl".

Finally, you'll want to create a new .vmdl file. Open it in your favorite text editor and add the following code to it. Close the file and then open the Source 2 Tools.

<!-- kv3 encoding:text:version{e21c7f3c-8a33-41c5-9977-a76d3a32aa0d} format:generic:version{7412167c-06e9-4698-aff2-e63eb59037e7} -->
{
	m_sMDLFilename = "models/humans/group01/male_07.mdl"
}

Once done, you can now open your .vmdl file and it will automatically compile itself to a .vmdl_c file!

The only thing left to do is to create material files which should have the same names and file structures as the Source 1 .vmt files. So for instance, I'd want to create a citizen_sheet.vmat file in the following file structure: materials/models/humans/male/group01/citizen_sheet.vmat

Note:You don't need to do this if you're running with '-nocustomermachine' as a launch parameter. This will enable you to modify the m_sMDLFilename line in the Model Editor.

Half-Life: Alyx and ModelDoc

ModelDoc-ImportAndConvertOldVMDL.png

Half-Life Alyx introduced a new model editor called ModelDoc. ModelDoc grants us a much wider variety of what we can do with our models, and allows access to special tools not available in the old Model Editor.

With ModelDoc, you can import an old .vmdl file by clicking File->Import->Import and Convert old .VMDL. When you do this, the model will actually process out all of it's sources (using the previously compiled .VMDL_C,) and it will spit out some FBX files for you to mess about with. You will then have the option to delete the old .mdl file, as it's unneeded.

This is ideal if you want to make modifications to help facilitate your model's transition to Source 2. Currently there's not a known way to batch process all of the .VMDL files in the game, but you can utilize this tool to fix problems with the importer.

Troubleshooting

Models that have flexes will import, but if the flexes have flex rules (such as HWM or FACs character models) then they will not import correctly. There is no known fix for this quite yet, but possibly with the decompiling process that ModelDoc does, we might be able to solve this.

Some models that are more complex will cause random crashes or breaks in the system, and won't import correctly. There is not much that can be done to help these at the moment, but taking a look at the VConsole might help you discover what's wrong.

To do: Note other issues and test compatibility with more games.

Read More