|
|
(57 intermediate revisions by 19 users not shown) |
Line 1: |
Line 1: |
| [[Category:Modeling]]
| | {{LanguageBar}} |
| == Definition ==
| | {{gldsrc topicon}}{{source topicon}} |
| | |
| The .QC file is a text based script file that controls the whole process of compiling an .SMD model into the final .MDL (game) model.
| |
| | |
| In the .QC, you set what the .MDL name will be, what .SMD files are used as the reference model, the physics model, and the LODs. You can also set various physics properties, and surface properties (these adjust things like the bullet decals, and the sound that is played when the object is hit).
| |
|
| |
|
| For a full list of .QC file commands, see [[QC Commands]]. | | :''For a list of '''QC commands''', see [[:Category:QC Commands]].'' |
| | :''To learn how to '''compile a model''', see [[Compiling a model]].'' |
|
| |
|
| == Making a new .QC file ==
| | A '''QC''' file is a script which controls the process of "compiling" [[SMD]]s into a binary [[model]] that can be loaded into a game. |
| | A QC configures the model's location and name, while SMD files are used to provide geometry, [[collision mesh]]es and [[skeletal animation|animation]]s, how the model reacts when shot, and so on. |
|
| |
|
| The .QC file varies little between regular prop models, so as a base it is best to start by simply copying an existing .QC file from another prop:
| | Comments can be ends of lines starting with <code>//</code>, or blocks contained between <code>/*</code> and <code>*/</code>. Source additionally supports end of line comments starting with <code>#</code> or <code>;</code>. |
| # Copy the an existing .QC file from another prop model.
| |
| # Rename the .qc file to the name of your prop.
| |
| # Open the .QC file in a text editor (like Notepad) and modifying it to be suitable for your new model. | |
|
| |
|
| The .QC file should be saved into the same folder as your .SMD model files.
| | Paths usually can contain a combination of either forward or backslashes, except for {{jbep3}}, which requires forward slashes due to adding support for {{w|escape sequence|escape sequences}} in QC files (due to shared code between [[VBSP]] and StudioMDL). |
|
| |
|
| == Typical .QC file ==
| | {{note|Although the "QC" file extension is derived from the [[QuakeC]] programming language used by {{quake|4.1}}, the syntax of StudioMDL QC files is significantly modified from the {{w|C (programming language)|C}}-like syntax used by QuakeC.}} |
| | {{tip|Shared QC files intended for use with {{ent|$include}} are typically given the extension {{code|qci}}, and outdated or deprecated QC files are typically given the extension {{code|qcx}}. This prevents them from attempting to be compiled when batch-compiling an entire folder. }} |
|
| |
|
| Below is an example of a typical .QC file for a world prop model:
| | == Simple example == |
| | Here is a very simple {{src|2}} QC file for a solid model without any animation or special properties (click on each command for details): |
|
| |
|
| $modelname props_foliage/tree_deciduous_01a.mdl | | [[$modelname]] "props_sdk/myfirstmodel.mdl" |
| $body "Body" "tree_deciduous_01a_reference.smd" | | [[$body]] mybody "myfirstmodel-ref" |
|
| |
| $scale 1.0
| |
| $staticprop
| |
| $surfaceprop "wood_solid"
| |
| $upaxis Y
| |
| | | |
| $sequence "idle" "tree_deciduous_01a_reference" fps 30 | | [[$surfaceprop]] combine_metal |
| | [[$cdmaterials]] "models/props_sdk" |
| | | |
| $lod 50 | | [[$sequence]] idle "myfirstmodel-ref" // no animation wanted, so re-using the reference mesh |
| {
| |
| replacemodel "tree_deciduous_01a_reference" "tree_deciduous_01a_lod1"
| |
| }
| |
| | | |
| $collisionmodel "tree_deciduous_01a_physbox.smd" | | [[$collisionmodel]] "myfirstmodel-phys" { $concave } // can be omitted if no collision is needed |
| {
| |
| //Mass in kilograms
| |
| $mass 350.0
| |
| $concave
| |
| }
| |
|
| |
|
| This .QC is sufficient to build a model with both a physics hull (physbox) and LODs (level of detail models).
| | Likewise, for {{goldsrc|2}}: |
|
| |
|
| == Individual commands ==
| | [[$modelname (GoldSrc)|$modelname]] "myfirstmodel.mdl" |
| Here follows a review of each line in the .QC show above:
| | [[$cd (GoldSrc)|$cd]] "." // look for SMDs in the same directory as the QC |
| | [[$cdtexture (GoldSrc)|$cdtexture]] "." // look for BMPs in the same directory as the QC |
| | [[$body (GoldSrc)|$body]] mybody "myfirstmodel-ref" |
| | [[$sequence (GoldSrc)|$sequence]] idle "myfirstmodel-ref" // no animation wanted, so re-using the reference mesh |
|
| |
|
| $modelname props_foliage/tree_deciduous_01a.mdl
| | {{note|The {{code|.smd}} file extension should usually be omitted from mesh and animation file names. Including it will cause {{goldsrc}} [[StudioMDL]] to fail to load the file. |
| The command <code>$modelname</code> sets the name and location of the MDL that is created. This MDL is going to be called <code>tree_deciduous_01a.mdl</code> and will be in the <code>models/props_foliage</code> folder. There is no need inside the .QC file to specify that this will be going into the models folder – that is presumed by [[Studiomdl]] (the program that builds MDL models, using the .QC file). | | {{src}} StudioMDL automatically looks for files in this order when no extension is present: |
| | :{{src13}} [[VRM]], [[SMD]], [[SMA]] (SMD), [[PHYS]] (SMD), [[VTA]], [[OBJ]], [[DMX]], [[w:XML|XML]] (DMX) |
| | :{{csgobranch}} [[FBX]], [[VRM]], [[DMX]], [[MPP]] (DMX), [[SMD]], [[SMA]] (SMD), [[PHYS]] (SMD), [[VTA]], [[OBJ]], [[w:XML|XML]] (DMX), [[FBX]] |
| | }} |
|
| |
|
| You will also note that there is nothing here saying which game this is model will be built under. This is because the model gets built under the current [[Game Directory|game directory]].
| | == File format == |
| | {{todo}} |
|
| |
|
| For example, if you have '''Counter Strike: Source''' set as your current game in [[VConfig]] or the '''Source SDK Window''', this .QC would build the model into <code>Steam/SteamApps/''username''/counter-strike source/cstrike/models/props_foliage/tree_deciduous_01a.mdl</code>.
| | == Files == |
| | {{todo}} |
|
| |
|
| $body "Body" "tree_deciduous_01a_reference.smd"
| | == See also == |
| The <code>$body</code> command sets the body group. Body groups are a way of having sub-models inside one MDL. (For example, you could have an MDL which is a lamp-post, and have different body groups that represent different styles of lampposts). If you aren't having any sub-body groups, then just set this to the name of your reference .SMD file.
| | * [[:Category:QC Commands]] |
| | * [[Compiling a model]] |
| | * [[LOD Models]] |
| | * [[Prop Types Overview]] |
| | * [[Notepad++ VDF languages]] |
| | * [[Highlighting and Compiling QCs with ConTEXT]] |
|
| |
|
| $scale 1.0
| | [[Category:Modeling]] |
| The <code>$scale</code> command allows you the scale the model when you compile it. Typically this should be left at 1.0, and all scaling be done in your 3D package, before you export the .SMD. This command should only be used for doing quick tests to a model.
| | [[Category:Plain text formats]] |
| | |
| $staticprop
| |
| The <code>$staticprop</code> command sets this model to work as a static prop only. Static props are a class of model inside the Source engine, that cannot move, or be moved by physics. They can still have a physics hull, so objects/players/bullets can still collide with them. The advantage of setting the <code>$staticprop</code> is that static-props are much less expensive than physics based props. If you know your model is never to move, then always set <code>$staticprop</code>.
| |
| | |
| $surfaceprop "wood_solid"
| |
| The <code>$surfaceprop</code> command sets the surface properties of the object. This has nothing to do with texture, but more the physical properties of the object. Whatever material you set here will effect what sound is played when the object is hit, and what decals appear on the object when it is shot (does it splinter like wood, or chip like stone?). A full list of surface properties available for you game can be found in under the [[Game Directory|game directory]] under <code>scripts\surfaceproperties.txt</code>. If it is not present, it will need to be extracted from the [[GCF|.GCF]] if you wish to view it.
| |
| | |
| $upaxis Y
| |
| The <code>$upaxis</code> command sets what axis should be considered up in the .SMD file. If you export a model from Maya, you need to have this set to "Y", since by default, Maya uses Y up. If you leave the $upaxis command out of the .QC file, then StudioMDL assumes the model is $upaxis Z (Max and XSI).
| |
| | |
| === Sequences ===
| |
| | |
| $sequence "idle" "tree_deciduous_01a_reference" fps 30
| |
| The <code>$sequence</code> command is used to set animation sequences. All models need to have an "idle" animation sequence – this is the animation that is played when the model is at rest (idling).
| |
| | |
| The command syntax is as follows:
| |
| | |
| $sequence "''sequence name''" "''name of SMD to use for the sequence''" ''framerate''
| |
| | |
| Since this model is not animated at all, you can just use the reference model (the .SMD that contains all the faces of the model) as the animation sequence – since this has no animation in it.
| |
| | |
| When exporting an animation, you will export a reference model, that holds just the bone and face information. Then, as a separate .SMD file you can export the animation – so you might have <code>solider_reference.smd</code> (the solider model, all rigged), and <code>solider_run_anim.smd</code> – which is just an .SMD that holds the bone animations in. You would then put this into your .QC as another sequence, this time called <code>run</code> instead of <code>idle</code>.
| |
| | |
| === Levels of Detail ===
| |
| | |
| $lod 50
| |
| {
| |
| replacemodel "tree_deciduous_01a_reference" "tree_deciduous_01a_lod1"
| |
| }
| |
| | |
| The <code>$lod</code> command is used to set levels of detail (LOD) models. A model can have any number of LODs, however each LOD should remove at least 140 polygons, otherwise it could well be more expensive than not having the LOD!
| |
| | |
| The number after the <code>$lod</code> command is the distance at which you want the model to swap to the LOD model. There are no magic numbers here, since models vary in scale and detail. Generally, set the first LOD to around 40 – and see how it looks in [[Half-Life Model Viewer]] ( a separate application that is used to view models). HLMV allows you to view your model, with the LOD switches at the distances you have set.
| |
| | |
| The <code>replacemodel</code> command is the actual command that swaps one .SMD for another, at a given distance. In the example above, the <code>tree_deciduous_01a_reference</code> is swapped for the <code>tree_deciduous_01a_lod1</code> model at a range of 50 units.
| |
| | |
| If you wanted another LOD, at say 100 units – the LOD section would look like:
| |
| | |
| $lod 50
| |
| {
| |
| replacemodel "tree_deciduous_01a_reference" "tree_deciduous_01a_lod1"
| |
| }
| |
|
| |
| $lod 100
| |
| {
| |
| replacemodel "tree_deciduous_01a_reference" "tree_deciduous_01a_lod2"
| |
| }
| |
| | |
| Here, at a range of 100 units, model <code>tree_deciduous_01a_lod1</code> is swapped out for <code>tree_deciduous_01a_lod2</code>.
| |
| | |
| To recap, the reference model is used up until 50 units, where it is swapped out for the first LOD model. Then, at 100 units this LOD1 model is swapped out for second LOD model.
| |
| | |
| === Collision models ===
| |
| | |
| $collisionmodel "tree_deciduous_01a_physbox.smd"
| |
| {
| |
| //Mass in kilograms
| |
| $mass 350.0
| |
| $concave
| |
| }
| |
| | |
| The <code>$collisionmodel</code> is the command to setup the physbox/collision hull. Straight after <code>$collisionmodel</code> you specify the name of the .SMD to use as a collision model. You should always make a unique physics model, and not just use the reference model as a collision hull.
| |
| The line <code>//Mass in kilograms</code> is just an information line, and has no effect on the computation of the .QC file. Any line with // at the start will be ignored. The <code>$mass</code> command sets the weight of the object. This is applicable when the object is a physics prop, and not a static prop. Make certain to set this correctly, otherwise your object will behave unrealistically. The <code>$concave</code> line says that the physics hull is made up of individual separate convex hulls (separate pieces), and not just one big hull.
| |
| | |
| == Conclusion ==
| |
|
| |
|
| This .QC file and the files it references are required to successfully [[Compiling Models|compile]] a Source engine model.
| |
|
| |
|
| == See also ==
| | {{stub}} |
| * [[Compiling Models]]
| |
| * [[QC Commands]]
| |
| * [[LOD_Models]]
| |
| * [[Prop Types Overview]]
| |