Porting humanoids to Portal 2: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (more work)
Line 1: Line 1:
[[File:Portal2 2017-06-25 19-42-08.png|thumbnail|right|The G-Man in Portal 2, complete with working eyes and skeletal and flex animation. ]]
[[File:Portal2 2017-06-25 19-42-08.png|thumbnail|right|The G-Man in Portal 2, complete with working eyes and skeletal and flex animation. ]]
Portal 2, due to numerous and sometimes unknown bugs, will not support the direct (i.e. "drag'n'drop") porting of humans and humanoids, such as those from Half-Life 2. By porting models in this method, the humanoids will crash Hammer, HLMV, and Portal 2 itself. {{todo|Do humanoids from other games, such as CS:GO, possess these same issues?}} By following this guide, you will be able to successfully port humanoid models to Portal 2.
Portal 2, due to numerous and sometimes unknown bugs, will not support the direct (i.e. "drag'n'drop") porting of humans and humanoids, such as those from Half-Life 2. By porting models in this method, the humanoids will crash Hammer, HLMV, and Portal 2 itself. By following this guide, you will be able to successfully port humanoid models to Portal 2. {{todo|Do humanoids from other games, such as CS:GO, possess these same issues?}}




==Keeping it from crashing==
==Decompiling==
# Extract the .mdl, .dx90.vtx, .dx80.vtx (if applicable), and .phy files from the VPK you are porting from, and place them in a handy directory.
# Extract the .mdl, .dx90.vtx, .dx80.vtx (if applicable), and .phy files from the VPK you are porting from, and place them in a handy directory.
# Download Crowbar, if you haven't already, by following the links [http://steamcommunity.com/groups/CrowbarTool here.]
# Download Crowbar, if you haven't already, by following the links [http://steamcommunity.com/groups/CrowbarTool here.]
# Open Crowbar's exe file (you may have to extract the archive first). Open the '''Decompile''' tab and under '''MDL file or folder''' browse to the .mdl of the model you are converting. Under '''Output Folder''', choose a nice clean directory to extract your files to. I recommend using the '''Full Path''' option, but it's completely up to you. Under '''Options''', make sure your options are the same as mine:  
# Open Crowbar's exe file (you may have to extract the archive first). Open the '''Decompile''' tab and under '''MDL file or folder''' browse to the .mdl of the model you are converting. Under '''Output Folder''', choose a nice clean directory to extract your files to. I recommend using the '''Full Path''' option, but it's completely up to you. Under '''Options''', make sure your options are the same as mine:
[[File:Crowbar 2017-06-25 19-33-07.png|790px|thumbnail|center|Options for Crowbar decompile.]]
[[File:Crowbar 2017-06-25 19-33-07.png|790px|frame|center|Options for Crowbar decompile.]]
 
==Recompiling==
# Find the QC and open it in a text editor. Look for the line beginning with "$ModelName" and remember the string in quotes. Next, scroll down to the area where every line begins with $Attachment -- it should look something like this. [[File:QC Attachments.png|center|$Attachment section]]
# If you see attachments named "EyeAttachRight" and "EyeAttachLeft", proceed to **Step 4**.
# Copy and paste the line that contains "eyes" in this section twice. Change "eyes" to "EyeAttachRight" in the first copy, and to "EyeAttachLeft" in the second. The section should now look something like this. [[File:QC Attachments 2.png|center|$Attachment section after editing]] Save and close the QC. Don't worry about what this is doing -- it will come in handy later.
# Open Crowbar and switch to the **Compile** tab. Under **QC file or folder**, browse to the QC file you just opened.
# For '''Output Folder''', switch to '''Full Path''' and type in ''C:\Program Files (x86)\Steam\SteamApps\common\Portal 2\portal2\models\[x]'', substituting ''[x]'' for the string you noted earlier, but with the file removed. Essentially, if the QC read ''"$ModelName"    "props_test\testanim\deyork.mdl"'', you would enter ''C:\Program Files (x86)\Steam\SteamApps\common\Portal 2\portal2\models\props_test\testanim\'' in the '''Full Path''' dialog.
# Under the '''Options''' section, make sure that '''Game that has the model compiler''' is set to Portal 2. Hit Compile! {{Note|Depending on your Steam library setup, you may have to run '''Set Up Games''' first.}}
==Porting the materials==
==Porting the materials==
placeholder text
# After compiling your model,
==Fixing the eyes==
==Fixing the eyes==
placeholder text
placeholder text

Revision as of 20:22, 25 June 2017

File:Portal2 2017-06-25 19-42-08.png
The G-Man in Portal 2, complete with working eyes and skeletal and flex animation.

Portal 2, due to numerous and sometimes unknown bugs, will not support the direct (i.e. "drag'n'drop") porting of humans and humanoids, such as those from Half-Life 2. By porting models in this method, the humanoids will crash Hammer, HLMV, and Portal 2 itself. By following this guide, you will be able to successfully port humanoid models to Portal 2.

Todo: Do humanoids from other games, such as CS:GO, possess these same issues?


Decompiling

  1. Extract the .mdl, .dx90.vtx, .dx80.vtx (if applicable), and .phy files from the VPK you are porting from, and place them in a handy directory.
  2. Download Crowbar, if you haven't already, by following the links here.
  3. Open Crowbar's exe file (you may have to extract the archive first). Open the Decompile tab and under MDL file or folder browse to the .mdl of the model you are converting. Under Output Folder, choose a nice clean directory to extract your files to. I recommend using the Full Path option, but it's completely up to you. Under Options, make sure your options are the same as mine:
File:Crowbar 2017-06-25 19-33-07.png
Options for Crowbar decompile.

Recompiling

  1. Find the QC and open it in a text editor. Look for the line beginning with "$ModelName" and remember the string in quotes. Next, scroll down to the area where every line begins with $Attachment -- it should look something like this.
  2. If you see attachments named "EyeAttachRight" and "EyeAttachLeft", proceed to **Step 4**.
  3. Copy and paste the line that contains "eyes" in this section twice. Change "eyes" to "EyeAttachRight" in the first copy, and to "EyeAttachLeft" in the second. The section should now look something like this. Save and close the QC. Don't worry about what this is doing -- it will come in handy later.
  4. Open Crowbar and switch to the **Compile** tab. Under **QC file or folder**, browse to the QC file you just opened.
  5. For Output Folder, switch to Full Path and type in C:\Program Files (x86)\Steam\SteamApps\common\Portal 2\portal2\models\[x], substituting [x] for the string you noted earlier, but with the file removed. Essentially, if the QC read "$ModelName" "props_test\testanim\deyork.mdl", you would enter C:\Program Files (x86)\Steam\SteamApps\common\Portal 2\portal2\models\props_test\testanim\ in the Full Path dialog.
  6. Under the Options section, make sure that Game that has the model compiler is set to Portal 2. Hit Compile!
    Note.pngNote:Depending on your Steam library setup, you may have to run Set Up Games first.

Porting the materials

  1. After compiling your model,

Fixing the eyes

placeholder text