|
|
|
|
|
|
|
|
| Links |
|
|
|
QC Files for Static/Dynamic/Physical Models - By MBD |
|
This tutorial was last updated on Jul 16, 2006.
You see them everywhere. Weither you are fighting the Combine, or trying to AWP the last Terrorist, you've seen a model. These multi polygonal objects make up the flesh and detail of a map. They come in very different types. There are your static props, which stay in one place and don't move at all. Physics props which can be moved by entities, NPCs, and/or the player. And dynamic props, which can parent moving objects, and can have special attributes like health applied to them, entity wise. We'll learn those three types of models in the tutorial, the basics of them, and compile them so they can be used.
Lets begin!
1. Setting it up all correctly.
2. Prop_static
3. Prop_dynamic
4. Prop_physics
5. Optional .QC commands
1. Setting it up all correctly.
Setting exactly what correctly? Well the placement of your materials, and folders. First make sure that your vconfig.exe is set to the correct game or mod. Build your model up to the point where you are going to UV, Skin, apply the material, or whatever you wish to call it.
The Source engine, as you may have read or already know, reads and renders its textures in a file format call .VTF (Valve Texture File). These are the base picture, or pictures. Another file, the .VMT (Valve Material) tells the Source engine how to set up the texture for correct rendering. Heres a good show of a .VMT for a model:
"VertexLitGeneric"
{
$basetexture "models/mbd"
$model 1
} |
In the end, the .VTF/.VMT combination gives us our material. For the tutorial, lets place them in the ".../MOD/materials/models" folder. With whatever program, apply the material using the .VTF file.
If you remember in HL1, when you put a model in Hammer and compiled, you could run right through the model? You had to CLIP it every time, and it was a pain. Well, same thing happens in Source. But, you don't have to use CLIP. If your model is very detailed, you will have to make a low polygon collision model. Stay on the low numbers because the higher the detail the harder the physics calculations will be. But a crate is as low poly as its going to get, so you can use the reference file. The collision model does have to have a material applied to it, but it can look as weird as you want, as it won't show up in game.
Lets move on to making this thing not go anywhere.
Prop_static
For a prop_static, all is truly needed is one bone for every vertex point to be assigned to. Export to .SMD as a reference. I'll name mine crate_ref.smd. Open up your collision model, and do the same. I'll name mine crate_col.smd. If you've read my How to compile a .MDL tutorial, you should know what to do here.
A basic prop static QC File looks something like this:
$modelname "\MBD\metalstatic.mdl"
$scale 1.00
$staticprop
$cdmaterials "models\"
$body "Body" "crate_ref.smd"
$sequence "idle" "crate_ref" loop fps 15
$collisionmodel "mbd_metalshelf_col.smd" {
$concave
} |
Voila!
Prop_dynamic
Well, Prop_static has the $staticprop command in the QC, Prop_physics has the prop_data integrated into its QC, so what does a prop_dynamic have? Well, neither!
$modelname "\MBD\metaldyncrate.mdl"
$scale 1.00
$cdmaterials "models\"
$body "Body" "metaldyncrate.smd"
$sequence "Idle" "metaldyncrate.smd" fps 30 ACT_IDLE 1
$collisionmodel "metaldyncrate_col.smd" {
$concave
} |
But wait! Theres more! Prop_dynamics are special, as they can be animated! For animated models, you will have to have your reference model with 2 or more bones. Export the bones assigned to the correct vertices right there. That will be your true reference model. Learn and animate your model in the program you are using. When done and everything is moving smooth, delete all the faces and vertexes, so there is only a bone mesh animating. Export that as your sequence smd. I have 3 animations, so there will be three different .SMDs. My animations make my crate turn on the Y axis, circle around a point on the Y axis, and does a shake, as if something was moving inside.
In the QC, all you have to do is add more $sequence commands, like so:
$modelname "\MBD\metaldyncrate.mdl"
$scale 1.00
$cdmaterials "models\"
$body "Body" "metaldyncrate.smd"
$sequence "Idle" "metaldyncrate.smd" fps 30 ACT_IDLE 1
$sequence "twist" "crate_seqtwist" loop fps 20
$sequence "turn" "crate_seqturn" loop fps 30
$sequence "shake" "crate_seqshake" loop fps 12
$collisionmodel "metaldyncrate_col.smd" {
$concave
} |
Prop_physics
Prop_physics can also be animated. All you have to do is the above. But for now, lets not make it animate. You will still have a reference SMD, and a collision SMD. But, there are some QC changes!
Heres a good example QC of the common oil drum model. Do note I removed some commands that may confuse you. I'll get back to those later.
$modelname "\MBD\metalphyscrate.mdl"
$scale 1.00
$cdmaterials "models\"
$body "Body" "mbd_metalshelf.smd"
$sequence "Idle" "mbd_metalshelf.smd" fps 30 ACT_IDLE 1
$keyvalues {
"prop_data" {
"base" "metal.large"
}
}
$collisionmodel "mbd_metalshelf_col.smd" {
$concave
$mass 50
} |
There are some changes that you can learn and follow, then there are new ones. For example this nice Prop_data. All physical properties have a prop_data. You can find a list of all the prop_data commands in the propdata.txt in the source engine.gcf. I also added a mass factor in the $collisionmodel command. The higher the mass, the harder it will be to move, the lower, the easier.
Additional QC Things
Hey you're done! ...Maybe. There are still things you may want to do. Like have your model have multiple skins. You can effect its surface property, for example, the sound it makes when the object hits something. You can effect the way it is dealt with, like if you want bullets to go through, but not the player. Ways so that the model will not fade away, but instead decrease in quality when you move away from it. And ways to effect the collision of the model. Lets start from the beginning
Skins
Apply base, first, or normal skin to the model first and export to .SMD. In the QC, under the $csmaterials command put:
$texturegroup skinfamilies {
{ "nameofSECONDskin.vtf" }
{ "nameofTHIRDskin.vtf" }
{ "nameofFOURTHskin.vtf" } |
And so on... Ta-da!.
Surface property
Above the sequences, or prop_data, you can override the surface property with $surfaceprop (Name). Insert in the (Name) place holder any value in the Material surface properties list. A full list can be found on the Valve Wiki here:
http://developer.valvesoftware.com/wiki/Material_surface_properties
Contents
A QC command, $contents, can effect the way the model is used in game. A value is listed in quotations separating them. Heres a list of values and their actions.
"grate" Makes not solid to bullets, solid to everything else
"monster" Makes it be acted in the world as an NPC
"notsolid" Makes it being able to be walked through
"ladder" Makes it be a ladder
Level of Detail
The $lod command makes the model lose detail in distance. You will have to make a lower poly model to be used for the distance model. Under the $model command put in:
$lod 30 {
replacemodel "ORIGNIAL REFERANCE MODEL" "LOWER POLY COPY"
} |
Phun with Physics
You can effect the inertia, damping, and rotational damping with the $inertia, $damping, and $rotdamping. Numeric values will have to be inputed after the command.
The End
All you have to do is drag and drop the QC into studiomdl.exe, and celebrate.
Good luck and have fun!
Still need help? Ask your questions in one of our HELP FORUMS
|
|
|
| Comments |
| Pandaboy - May 6, 2009 |
somehow the "slashes" didn't show up in the last part, so here it is again with ) replacing the "slashes":
the vmt's location relative to materials folder:
PB_textures)models)gothic_light_wall
and inside this folder is the VMT and VTF, both named gothic_wall_light.
The texture shows up in hammer, so there's no problem there.. Here's the VMT file anyway:
"VertexLitGeneric"
{
"$basetexture" "PB_textures)models)gothic_light_wall)gothic_light_wall"
"$surfaceprop" "metal"
"$envmap" "env_cubemap"
"$model" 1
}
|
| Pandaboy - May 6, 2009 |
I'm new to modelling and have a problem with the material of my model.
It simply doesn't show up! I have checked my QC file and my VMT file
so everything is correct, but the texture still doesn't show up in model
viewer or hammer editor.
QC file:
$modelname PB_props/gothic_light_wall.mdl
$cdmaterials PB_textures/models/gothic_light_wall
$staticprop
$scale 0.4
$body peanut_ring "gothic_light_wall_Ref.smd"
$sequence idle "gothic_light_wall_Idle.smd" fps 15
$collisionmodel "gothic_light_wall_phys.smd"
{
$automass
$concave
}
$keyvalues
{
"prop_data"
{
"base" "Metal.Medium"
"explosive_damage" "0"
"explosive_radius" "0"
}
}
I know the explosive part is unnessesary, but I just copy and paste this qc for every model I make. It has worked like.. 50% of the time to get the model into hammer editor with the texture applied, and I don't know what goes wrong..
The VMT and the VTF is in the location (relative to the materials folder of the game i'm mapping for):
PB_texturesmodelsgothic_light_wall
and inside this folder is the VMT and VTF, both named gothic_wall_light.
The texture shows up in hammer, so there's no problem there.. Here's the VMT file anyway:
"VertexLitGeneric"
{
"$basetexture" "PB_texturesmodelsgothic_light_wallgothic_light_wall"
"$surfaceprop" "metal"
"$envmap" "env_cubemap"
"$model" 1
}
Do you find what's wrong?
Also, when you model, what program do you use?
Please reply to my email, and in case it doesn't show up, here it is:
pandaboy_@live.se |
| joe_rogers_11155 - Oct 10, 2008 |
| Hey guys I am having a hard time learning how to make very small foliage on my grass. I am trying to learn how to make prop_detail that will randomly generate tiny weeds and details on my grass. I have read all kinds of descriptions of prop_detail and I can't seem to learn it. Can someone please write me a little mini tutorial for using prop_detail? Thank you. |
|
|
|
|