S2General/Converting Source 1 Models to Source 2

From Valve Developer Community
Revision as of 02:03, 22 May 2020 by Hl2awpp (talk | contribs)
Jump to navigation Jump to search

Template:Otherlang2 Source 2 has a built-in system for taking old .mdl files from Source 1 and converting them to Source 2. It's not a perfect system and 9 times out of 10, it will not compile, but it can be great if you are porting content en masse from Source 1 to Source 2.

Supported MDL Formats

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.

Todo: 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/content/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.pngNote: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.

Other Notes/Broken Things

The biggest problem this auto-conversion tool has is that flexes are non-functional. Some have their flexes vertex data completely destroyed (such as HWM models from SFM,) some just have a mix of working/non-functioning flexes.

The other problem is the lack of support for certain Source 1 Engine branches, so importing models that haven't already been converted for Source Filmmaker can be quite difficult.

Todo: Note other issues and test compatibility with more games.

Read More