Creating a .QC File

Tutorial collection, comprehensive listings on main site.

Creating a .QC File

Postby Tutorial on Tue Jul 05, 2005 10:00 pm

category
Modelling

description
Taking you through the process of compiling your model.

keywords
model, models, modelling, qc, file, creating.

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..)

http://www.interlopers.net/downloads/files/exempleQC.qc

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"

$sequence
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
$concave
}


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:

$keyvalues
{
"prop_data"
{
"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.

http://www.interlopers.net/downloads/files/propdata.txt

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

Paper.Small
Cloth.Medium

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:

$modelname
$cdmaterials
$body
$staticprop
$surfaceprop
$sequence
$collisionmodel


A prop_physic requires those commands:

$modelname
$cdmaterials
$body
$sequence
$collisionmodel
$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

pause


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

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

Re: Creating a .QC File

Postby Dr. Delta on Sun Mar 08, 2009 8:49 pm

Very nice tutorial. Helped me a lot.

Also, the .bat file is missing.

ps. it's "example" not "exemple"
User avatar
Dr. Delta
Veteran
Veteran
 
Joined: Thu Dec 27, 2007 1:18 pm
Location: People's Republic of Porygon

Re: Creating a .QC File

Postby Zerreth on Tue Jun 23, 2009 8:44 pm

delta_nl wrote:Also, the .bat file is missing.


Uhm yeah I second that, anyone who can help me out with this one ?
User avatar
Zerreth
Regular
Regular
 
Joined: Sat Nov 04, 2006 2:12 am
Location: Belgium

Re: Creating a .QC File

Postby TicTac on Tue Jun 23, 2009 8:50 pm

Just a note, you talked about $staticprop but this parameter has nothing at all to do with static/phys props. it simply means that there's only one bone and one animation in the model. ;)
Competent Level Designer, 3D Artist.
I don't really look like my avatar
User avatar
TicTac
Veteran
Veteran
 
Joined: Sat Aug 02, 2008 1:30 am
Location: Philadelphia

Re: Creating a .QC File

Postby Dr. Delta on Tue Jun 23, 2009 9:59 pm

TicTac wrote:Just a note, you talked about $staticprop but this parameter has nothing at all to do with static/phys props. it simply means that there's only one bone and one animation in the model. ;)


That makes it automatically static. Because it's not moving.

right?
User avatar
Dr. Delta
Veteran
Veteran
 
Joined: Thu Dec 27, 2007 1:18 pm
Location: People's Republic of Porygon

Re: Creating a .QC File

Postby The Wanderer on Wed Jun 24, 2009 10:02 am

Zerreth wrote:
delta_nl wrote:Also, the .bat file is missing.


Uhm yeah I second that, anyone who can help me out with this one ?


I third this, does anyone know what should be written in the bat file?
Image
User avatar
The Wanderer
Senior Member
Senior Member
 
Joined: Tue Dec 27, 2005 1:03 pm
Location: Belgium

Re: Creating a .QC File

Postby stoopdapoop on Wed Jun 24, 2009 11:04 am

delta_nl wrote:
TicTac wrote:Just a note, you talked about $staticprop but this parameter has nothing at all to do with static/phys props. it simply means that there's only one bone and one animation in the model. ;)


That makes it automatically static. Because it's not moving.

right?


Nope, static props have different properties, no network traffic, smaller memory footprint, can be lightmapped (where each face counts as a lightmap square), they can effect the light mapping on brushes, and don't get dynamic shadows. (but they do get projected texture shadows, just like everything else)
Last edited by stoopdapoop on Wed Jun 24, 2009 4:46 pm, edited 1 time in total.
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Creating a .QC File

Postby Dr. Delta on Wed Jun 24, 2009 11:49 am

The Wanderer wrote:
Zerreth wrote:
delta_nl wrote:Also, the .bat file is missing.


Uhm yeah I second that, anyone who can help me out with this one ?


I third this, does anyone know what should be written in the bat file?


Yes. Let me look it up.



Well, read the post below. :)
Last edited by Dr. Delta on Wed Jun 24, 2009 11:59 am, edited 1 time in total.
User avatar
Dr. Delta
Veteran
Veteran
 
Joined: Thu Dec 27, 2007 1:18 pm
Location: People's Republic of Porygon

Re: Creating a .QC File

Postby Dr. Delta on Wed Jun 24, 2009 11:58 am

Here you go.

Code: Select all
@echo off
@rem setlocal makes all of these 'set' calls temporary.setlocal@rem replace with your path to whichever one of the tools you want to run.
set sdkdir="C:\Program Files (x86)\Steam\steamapps\username\sourcesdk\bin\ep1\bin"
@rem replace with the path to your specific mod., this overrides VPROJECT.
set gamedir="C:\Program Files (x86)\Steam\steamapps\username\half-life 2 episode two\ep2"
@rem
set gamedir="C:\Program Files (x86)\Steam\steamapps\username\half-life 2 episode two\ep2"
@rem replace with the path to your specific map.
set modelpath="C:\Users\Delta\Documents\3dsmax\scenes\model_name.qc"
%sdkdir%\studiomdl.exe -game %gamedir% %modelpath%
@pause


Change the dirs from
-set sdkdir
-set gamedir
-set modelpath
to your own personal paths.


you can edit the bat file with notepad etc.
Success.
User avatar
Dr. Delta
Veteran
Veteran
 
Joined: Thu Dec 27, 2007 1:18 pm
Location: People's Republic of Porygon

Re: Creating a .QC File

Postby The Wanderer on Wed Jun 24, 2009 12:46 pm

Image

Much appreciated.
Image
User avatar
The Wanderer
Senior Member
Senior Member
 
Joined: Tue Dec 27, 2005 1:03 pm
Location: Belgium

Re: Creating a .QC File

Postby Zerreth on Wed Jun 24, 2009 4:34 pm

Hmmm I'm getting errors... Could someone help me out with this plz ?

Image
Image
User avatar
Zerreth
Regular
Regular
 
Joined: Sat Nov 04, 2006 2:12 am
Location: Belgium

Re: Creating a .QC File

Postby stoopdapoop on Wed Jun 24, 2009 4:41 pm

all paths are relative to the mod directories, so modelname starts in "models" and $cdmaterials starts in the materials folder. Also, when specifying a materials path you don't need to actually give the filename of the texture you're using, the filename is compiled with the model, so you're just telling it where to look.

it'd be easier to fix your QC if you posted the text (opposed to your screenshot of the text :) ) but replace the first two lines of your QC with

Code: Select all
$modelname "test\testcube.md"
$cdmaterials "models/test/"


that little "<1>" after testcube.qc in the cmd prompt window is telling you what line the compiler messed up on, in your case, it was the first line :D
I'm Brown
Image
User avatar
stoopdapoop
Veteran
Veteran
 
Joined: Sun Aug 21, 2005 2:14 am
Location: Ann Arbor, MI

Re: Creating a .QC File

Postby Zerreth on Wed Jun 24, 2009 4:56 pm

Thanks :D But unfortunately I'm getting a new stop error this time :S

Image
User avatar
Zerreth
Regular
Regular
 
Joined: Sat Nov 04, 2006 2:12 am
Location: Belgium

Re: Creating a .QC File

Postby Surfa on Wed Jun 24, 2009 5:02 pm

You need to end you key value block with another brace }

Also the warning means you are missing a .dll file in the source sdk bin folder try re-installing or downloading that .dll and placing it in the bin folder.

Code: Select all
$keyvalues
{
"Metal.small"
{
//blah text
}
}
Surfa
May Contain Skills
May Contain Skills
 
Joined: Sun Dec 30, 2007 3:04 pm

Re: Creating a .QC File

Postby Zerreth on Wed Jun 24, 2009 5:17 pm

Thx again. As for the missing .dll file, reinstalling the SDK doesn't seem to help. Could someone upload this file (p4lib.dll) for me ? Thx
User avatar
Zerreth
Regular
Regular
 
Joined: Sat Nov 04, 2006 2:12 am
Location: Belgium
Next

Return to Tutorials

Who is online

Users browsing this forum: No registered users