Official Guide Modeling 'n stuff


Apr 26, 2016

-CROWBAR Compiler:
-GMAD Extractor:
-Blender Source plugins:

The basic model is a single file, with the .mdl extension (figure 1)
However, if we open up Crowbar and decompile it...(figure 2)

We'll have a serie of text files (open them with notepad++, or if you are stupid and obsessive as me with nodepad) (figure 3)

If you open the .qc you will notice some things (it's another model but it's just to show you)

(figure 4 textures and bodygroups)
(figure 5 animations)

If you modify this file the changes will reflect on the model itself, for instance, by changing

$includemodel "humans/male_shared.mdl"
$includemodel "police_animations.mdl"

Once you are finished you need to recompile the model (figure 6)

When model has finished compiling press "Use in view" and "View"

The model will now have CP animations (figure 7), if you can add or remove bodygroups or skins this way, we can also work with embed animations but we'll talk about it later.

If your model is pink checkered, it means it doesn't find the textures, be sure all the texture are in place and working and check the path for them, if the model doesn't show there are some problems with the path see at the top of the .qc file.

Now, if you look into the .smd files with "reference" at the end under the .qc files you will notice this (figure 1)
The names you will encounter in this file are the textures used by this model, now if you go look into the material folder you should find two files with this name (figure 2)

The .vmt file is a text based file that contains the data and address of the texture (figure 3)

The .vtf contains the real texture (figure 4)

If you want to change the texture click on "file" and then "import", remember, the engine will modify your image resolution to make them fit into powers of 2 spaces.

If you want to reskin a model import a texture and save it with the same name, and the same "Various options", if you want to make a new model save it with another name, a .vtm file will be automatically created, mind out however, its options will be bare and basical and may not fit well for super shiny models.

If you want to add another texture to a model simply modify the .qc file of the model and add another skin like this:

$texturegroup "skinfamilies"

The texture you specify in the first "block" will change, the others will remain the same (figure 5)

First, you need to do the animation in Source Filmmaker, be sure to use a model that uses the Valve Biped (the green/red/yellow skeleton, if your models bones are just purple dots then it won't work for any other models or it will be corrupted), when you are finished right-click on the model and then select "Export" and "animation", be sure not to leave any blank space and if you are gonna make a looped animation, make sure the end matches the beginning. (Figure 1)
The animation will be exported into a .dmx file, however what we need is a .smd file, for the conversion we need blender: first of all load the model you want to animate, to do so select "File" then "Import", now if you have installed the blender source plugins you should have into these option "Source Engine (.smd, .vta, . dmx, .qc)", select it and import JUST one of the modelname_reference.smd, NOT THE QC (I mean nothing bad happens if you do it but it will be confusting to edit), then do the same process for the animation file. (Figure 2)
For some unknown reasons the animation will now contain wide blank spaces before and after the actual animation, for now just identify this place and set them here (Figure 3) after you did it select the skeleton and compile this page (Figure 4).
Now come the boring part, without closing Blender open up the .smd file you have just saved (with something like Notepad++):
1) Find out "time 0"
2) Select EVERYTHING from "time 0" to "time" and the number you got near "start" in Blender (this one excluded) and delete it
3) Do the same thing with the last "time" and the "time" you got in "end"

For istance if you got (you'll never got it):

time 0 *stuff*
time 1 *stuff*
time 2 *stuff*
time 3 *stuff*
time 4 *stuff*

But in Blender you found the animation goes only from 1 to 3 you delete everything except

time 1 *stuff*
time 2 *stuff*
time 3 *stuff*

Got it? Now time to mount up the actual animation! Here I'll show you how to import animation embedding them into the model rather than make them into packs, the compiler can't currently support that, but if in the process is very similar, first place the .smd file with your animation in the decompiled model animation folder (see Part One, Figure 3) then open up the .qc file and find the place where the $includemodel are (see Part One, Figure 5) and write in:

$sequence "anameforyouranimation" "male_01_anims\animationname.smd" {
fps 24
*write loop here if it's looped*

Then compile the model (Figure 5)

If your animation involves movement write under fps:

walkframe (*number of frames your animation has*) *direction*

The direction can be LX LY LZ LXR LYR LZR, LX is the front, LXR is the back etc., the movement will be authomatically calculated using the movement of your model, to add movement to a model make the model move during the animation moving its "Root Transform" bone, then right click on this bone and select "DAG Utilities menu" and "transfer_motion_to_children", once the model has compiled check in the model viewer, "Render" section, if there is any movement by selecting "movement" and seeing if there are blocks moving around.

Comment from Lemon: Btw, found this video pretty helpful while trying it, should help you too