Creating a .QC File

Due to a popular demand (I think), it's time for a little model compiling tutorial. Please note that in this tutorial I'm going to show you only the QC commands, exporting and other modelling stuff will be showed in another tutorial. I'm going to cover simple physic, dynamic and static models. No ragdolls, no npc or vehicles.

Now, assuming you have all the required SMD files we're going to compile the model. Those SMDs are:

Reference model (.smd exported as a reference frame. should be named model_ref.smd)

idle animation (.smd exported as an animation sequence. should only contain frame 0 and frame 1 of an idle animation. should be named model_still.smd)

physic model (.smd exported as a reference frame. should be named model_phys.smd)

Now that you have all your SMD files, it's time to compile.

I suggest to start you take my exemple QC file. It contains all the basic commands to create a static or simple physic prop.
(save target as..)

Here's the description of each command you will find in the exemple QC.

$modelname This tells the compiler where to save the output .MDL file. The path is based on the game config you are on. If you open the Source SDK application, you'll see at the bottom a list of game you have for the Source Engine. Select the one your making your model for, your mod should be listed if you created it correctly. It will save the .MDL file in the models folder of your mod/game. For a mod called MOD1, it would be:

C:\Program Files\Valve\Steam\SteamApps\SourceMods\MOD1\models\ and then the path specified in the $modelname command. If your command is:

$modelname props_city\biglamp01.mdl

Then your full model path will be:

C:\Program Files\Valve\Steam\SteamApps\SourceMods\MOD1\models\props_city\biglamp01.mdl

Note that the path+modelname after the $modelname command doesn't need "".

$cdmaterials This command tells the engine where to take the textures. When you exported your model_ref.smd, each face was assigned to a texture name, but not a path. Now this command tells the engine in what folder is the texture. The base path for texture is:

C:\Program Files\Valve\Steam\SteamApps\SourceMods\MOD1\materials\

Usually, you create a folder in materials called models, where you will put all the textures used for models. You should also create a subfolder in materials\models with the name of the folder where you model is placed, like our biglamp01.mdl is in props_city, so your textures will be placed in materials\models\props_city\biglamp01_texture.vmt. The final path will be:

C:\Program Files\Valve\Steam\SteamApps\SourceMods\MOD1\materials\models\props_city\biglamp01_texture.vmt

In that case our command will look like this:

$cdmaterials models\props_city\

$scale This command can change the scale of your model, if needed. When you make your model, you should consider that 1 unit in 3Ds MAX = 1 unit in Hammer. But if for any reason the model is wrongly scaled, you can change the value of this command, where 1 = the original size of the model.

$body This tells the compiler what SMD is the reference model. Some models have many subparts, so they have a couple of commands like this. But in a simple static or physic prop, only one is needed. Your command should look like this:

$body studio "biglamp01_ref.smd"

studio is the name of the subpart. But that's not very important for a simple prop. Then you have the name of the reference file between "". Note that there's no path because the SMDs should be in the same folder as the QC file.

$origin X Y Z This command is not needed for most of the props, it's mainly for special purposes like first person view weapons. Just replace the X, Y and Z letter by coordinates that will modify the origin. I suggest you simply erase it from the QC file if your only making props.

$upaxis Y This simple command is only needed for Maya users. Since Maya uses the Y axis as the vertical axis, just insert that command in your QC file to make the model straight. For MAX users, simply erase it.

$staticprop This command tells the engine that this prop is a static prop. It collapse all the bones and attachments to the center origin at 0,0,0. If you put this in your QC, you can only use this model as a prop_static or as a prop_detail in Hammer.

$surfaceprop Use this command in a prop_static model to tell the engine what type of prop it is. Here's a list of the values you can put between the "" just after the command:

http://developer.valvesoftware.com/wiki ... properties
Should look like this:

$surfaceprop "metal"

This is a sequence command. It include an animation in a model file. Here a typical command for a static prop:

$sequence idle "biglamp01_still.smd" loop fps 1

idle is the name of the sequence.
between the "" is the name of the sequence file.
loop means the animation is looped.
fps 1 is the frame per second rate of the sequence. In this case 1, no need of more since the animation is idle.

$collisionmodel This is the physic model command. It's needed in both static and physic models, but not in prop_detail. Here's a typical physic model command:

$collisionmodel "biglamp01_phys.smd" {
$Mass 10

Here you only need to change the physic model filename and the mass. The mass is in kilograms (2.2 pounds = 1 kilogram).

$keyvalues Keyvalues is only needed for prop_physic. It's like $staticprop command. It tells the engine how the model should react to the physic. Here's a typical keyvalues command:

"base" "Type.Size"

You just need to change the Type.Size value by a propdata. These values are located in the source engine.gcf/hl2/scripts/propdata.txt file, but I got you a copy of it.

There you have all the propdata of the Source engine. Just replace Type.Size by any of those except the .Base ones. Exemple:


and so on...

Simply use the one you think is more appropriate to your model.

Quick Notes:

A prop_static or prop_detail requires those commands:


A prop_physic requires those commands:

$keyvalues propdata

For more information about the prop types, refer to this:

Valve Wiki Link

Now to compile your model, you need to create a Batch File. I suggest you simply download mine.
(save target as...)
http://www.interlopers.net/downloads/fi ... mpiler.bat
Put it in your sourcesdk\bin\ folder and right-click on it, then select Modify. Just change the path and model name to yours. A typical command should be:

studiomdl.exe ..\cstrike_sample_content\props_city\biglamp01.qc


Then run your Batch File with Steam running and it should work!


View comments ( 24 )

Back to top