Portal 2 custom models

From Valve Developer Community
Jump to navigation Jump to search
Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Underlinked - Logo.png
This article needs more Wikipedia icon links to other articles to help Wikipedia icon integrate it into the encyclopedia. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
Broom icon.png
This article or section needs to be cleaned up to conform to a higher standard of quality.
For help, see the VDC Editing Help and Wikipedia cleanup process. Also, remember to check for any notes left by the tagger at this article's talk page.

About

Note.pngNote:This article is not for the creation of custom models for Portal 2. Click here to learn how to create models.

Studiomdl does not recognize exports made by SMD Exporter. This guide will show the steps to allow Studiomdl to recognize these files.

Reference Code

This is the .smd file that Studiomdl recognizes in the Portal 2 folder:

version 1
nodes
  0 "static_prop" -1
end

skeleton
time 0
  0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
end

triangles
  combine_panel001.bmp
    0 58.059105 -108.627701 38.488201 0.072002 0.023401 0.997130 0.289500 -0.998100
    0 52.870804 -94.276199 38.526199 0.072002 0.023401 0.997130 0.316600 -0.998100
    0 45.461502 -78.973999 38.702400 0.072002 0.023401 0.997130 0.355300 -0.998100
  combine_panel001.bmp
    0 73.021011 -99.157303 38.303902 -0.270688 -0.028099 0.962257 0.211300 -0.998100
    0 74.424805 -114.241302 38.257702 -0.269592 0.002400 0.962972 0.203900 -0.998100
    0 75.247810 -114.277496 38.488201 -0.275013 0.013601 0.961344 0.199600 -0.998100
  combine_panel001.bmp
    ...
end

No nodes other than 0 "static_prop" -1 and (for props):

skeleton
  time 0
  0 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
end

Here is the .qc file:

 $cd "..."
 $modelname "Combine_Room\combine_wire001.mdl"
 $model "Body" "combine_wire001_reference.smd"
 $lod 10
  {
   replacemodel "combine_wire001_reference" "lod1_combine_wire001_reference"
 }
 $lod 15
  {
   replacemodel "combine_wire001_reference" "lod2_combine_wire001_reference"
 }
 $lod 20
 {
   replacemodel "combine_wire001_reference" "lod3_combine_wire001_reference" 
 }
 $lod 25
 {
  replacemodel "combine_wire001_reference" "lod4_combine_wire001_reference"
 }
 $cdmaterials "models\combine_room/"
 $hboxset "default"
 $hbox 0 "static_prop" -77.137  -173.657  -40.269  77.137  173.657  40.269
 // Model uses material "combine_panel001.vmt"
 $surfaceprop "metal"
 $illumposition 0.000 0.000 0.000
 $sequence idle "idle" fps 30.00
 $collisionmodel "phymodel.smd" 
 {
 	$concave
 	$mass 30.0
 	$inertia 1.00
 	$damping 0.00
 	$rotdamping 0.00
 }

$lod and $hbox and $collisionmodel are unnecessary, so here are the bare-bones to get your model into Hammer:

 $cd "..."
 $modelname "Combine_Room\combine_wire001.mdl"
 $model "Body" "combine_wire001_reference.smd"
 $cdmaterials "models\combine_room/"
 $hboxset "default"
 $surfaceprop "metal"
 $illumposition 0.000 0.000 0.000
 $sequence idle "idle" fps 30.00

Finally, to get the model into Hammer, you need the file called idle.smd:

version 1
  nodes
    0 "static_prop" -1
end
skeleton
  time 0
    0 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000
  time 1
    0 0.000000 0.000000 0.000000 0.000000 -0.000000 0.000000
end