Compiling Props for Source

Tutorial collection, comprehensive listings on main site.

Compiling Props for Source

Postby Tutorial on Sat Sep 19, 2009 8:00 am

category
General Half-Life 2/Other

description
A detailed topic on compiling props to be ready for Source.

keywords
compiling, compile, props, prop, source.

Here's a tutorial on how to compile models for the Source engine, since I get many requests on how to do so. First off, I used 3DSMax7, which has a .smd import/export plugin. .smd is the file format of all of the source engines model before they are compiled into .mdl. So if you use maya or Blender I cannot guarantee that the plugins stated here will work for you. Also I believe that XSI comes with a .smd exporter but no importer from what I remember when trying to learn it.

3DSMax 7/8
Smd Import Plugin Download
Smd Export Plugin Download

Blender
Smd Export Plugin Download
Smd Import Plugin Download

Maya
Maya's .smd export/import scripts are actually within the SDK, located in:
"Steam\SteamApps\(username)\sourcesdk\maya"

So, basically with these you export your model as .smd and then it's proper.

You will also need guistudiomdl to compile. (Goes in sourcesdk/bin/orangebox)

Guistudiomdl Download

Now that you have all the tools necessary, we can get onto things.

To make things clear for the tutorial, I'd like to say that the way I compile is I made a folder in my "Steam\SteamApps\(username)" directory called "Modeling" as it just seemed like a good organized way to do things. Next I made two folders within that called "Custom" and "Valve." The Valve folder would house any decompiled models I needed for reference and such, while the custom folder is anything I make myself. Within these two folders, I create a new folder with a good, telling name each time I make a new model, since every model should have its own folder, seeing as it houses 3+ files with essentially the same name every time.

1. First off, open the model you'd like to edit. Now if the model is a prop_static, or a simplistic prop_physics, just export it as a reference .smd with a relevant name to a folder of its own. (Cannonfodder's .smd plugin asks whether you want to export skeletal structure or as a reference, not sure about Blender/Maya/XSI/Milkshape.)

2. Export the model again, but this time as a skeletal structure to the same folder, but this time name it "idle.smd"

3. You're done with the model editor, it's .qc time. (.qc is the file that contains all compiling information for a model, such as model name, materials directory, phymodel settings, bone hierarchy, etc.)

4.
Go to the folder where your reference and skeletal structure have been exported to and make a text file with a fairly relevant name to your model, and make its file extension .qc. (Set NotePad as your primary .qc editor unless you have some sort of super NotePad like NotePad++)

5. Use this reference .qc with the bare basics:
Code: Select all
//$cd is the location of the folder housing the .smd files.
$cd "Steam\steamapps\(AccountName)\Modeling\Custom\MyModel\"

//$Modelname prepends to the models directory. So anything after is creating another folder.
$modelname "[props_mymodels/Modelname.mdl]"

//$model is the name of the reference smd.
$model "studio" "MyModel.smd"

//!!This tells the engine this prop is STATIC and therefore DOES NOT MOVE!!
//!!Remove the $staticprop line if your model is a prop_physics!!
$staticprop

//$cdmaterials prepends to the materials directory.
$cdmaterials "models\props_mymodels\"

$hboxset "default"

//Surfaceprops must be lower case: wood, metal, glass, etc
$surfaceprop "default"

/Animation of idle, required, doesn't do anything since the model is static, though.
$sequence idle "idle" loop ACT_VM_IDLE 1 fps 30.00

//$collisionmodel is the phymodel, what you collide with, etc. Can be set to the same as your normal model's name, but if you have a complex model which requires maticulous collisions then make a second model of much blockier quality which will be the model's solid areas.

$collisionmodel "MyModel_phy.smd" {
//Weight in Kilograms
   $mass 8.0
//It's a property of matter!
   $inertia 1.00
   $damping 0.00
   $rotdamping 0.00
}


6. Save the .qc and open guistudiomdl. Select the game and engine you plan to compile for, and load the .qc you just made. Now hit compile and everything should compile just fine.

Now to compile the materials! (IT JUST NEVER ENDS, DOES IT? :D) To do so:

1. Open the texture files of the model and save them to "Steam\steamapps\(AccountName)\(Game)\(Game's Acronym)\materials\models\props_mymodels\" (Or wherever you set the $cdmaterials) as the .vtf format using Nemesis' .vtf plugin.
.vtf Plugin for Photoshop

2.Next we need to create a .vmt file for these materials:

Code: Select all
"VertexlitGeneric"
{
   "$basetexture" "models/props_mymodels/mytexture"
        //If your model has a normal map uncomment the $bumpmap line!
   //"$bumpmap" "models/props_mymodels/mytexture_normal"
}


(This example is what I basically use for TF2 materials as it makes them look alot nicer than the basic .vmt)

Code: Select all
"VertexlitGeneric"
{
   "$basetexture" "models/props_mymodels/mytexture"
   "$bumpmap" "models/props_mymodels/mytexture_normal"
   "$phong" "1"
   "$phongexponent" "2"
   "$phongboost" "1"   
   "$lightwarptexture" "models/player/pyro/pyro_lightwarp"
   "$phongfresnelranges"   "[.3 .5 .6]"
   "$halflambert" "1"

   // Rim lighting parameters
   "$rimlight" "1"                                    // To enable rim lighting (requires phong)
   "$rimlightexponent" "1"                              // Exponent for phong component of rim lighting   
   "$rimlightboost" "1"                              // Boost for ambient cube component of rim lighting
   // Cloaking
   "$cloakPassEnabled" "1"
   "Proxies"
   {
      "weapon_invis"
      {
      }
   }
}
}


That should be it for compiling a static model. Compiling things like playermodels, cars, or viewmodels is a whole different task which I will teach you about soon.

More Random Stuff You Should Know:
- VertexLitGeneric is at the start of every model .vmt of a normal variety. World textures that will be used on brushes should be "LightMappedGeneric"
- The Model Decompiler is located here: Download
- Qc Commands are located here: VDC Qc Article
- Vmt Commands Here: VDC Vmt Article
- $JiggleBone Article (For Qc's): VDC JiggleBone Article
- To decompile EP2, TF2, or Portal Models, open them with a hex editor or NotePad++ and change "IDST0" or "IDST." to "IDST,"
- The download for NotePad++ is here: Download
- How to add multiple skins!
Code: Select all
//Note that the first skin named is the skin you should have exported the model with.
$texturegroup skinfamilies
{
   { "Skin1.vmt" }
   { "Skin2.vmt" }
}


- Jman
- Don't send PM's to this user -
Tutorial
Not A Real User
 
Joined: Sun Mar 06, 2005 11:00 pm

Re: Compiling Props for Source

Postby Guessmyname on Sat Sep 19, 2009 8:22 am

You missed out the collision mesh.
User avatar
Guessmyname
1337 p0st3r
1337 p0st3r
 
Joined: Sun Mar 27, 2005 10:38 pm

Re: Compiling Props for Source

Postby cheesemoo0 on Wed Oct 28, 2009 4:13 am

Add an extra "/" to your animation comment. Thanks for this tut!
User avatar
cheesemoo0
Been Here A While
Been Here A While
 
Joined: Tue Jun 17, 2008 2:38 am
Location: USA

Re: Compiling Props for Source

Postby cheesemoo0 on Thu Dec 03, 2009 3:28 am

I also noticed on the VDC under model it said it should be only used for complex models such as faces not static props. Use $body instead.

Another thing $staticprop IS used for prop_physics.
User avatar
cheesemoo0
Been Here A While
Been Here A While
 
Joined: Tue Jun 17, 2008 2:38 am
Location: USA

Return to Tutorials

Who is online

Users browsing this forum: No registered users