Welcome to another on of my tutorials. In this tutorial, I will teach you how to compile a custom model to be used in your maps as a prop_static. Sorry for the lack of pictures, as I don't really think there is a need for them seeing as how it's a pretty simple process and there aren't really any screenshots to see.
Note: I am only showing you how to compile the actual model. You need to make the model, UVmap and the collision files yourself.
Required Files:
The Exported textured Model (.smd)
The collision Model (.smd)
The Texture file
In this tutorial, I will be compiling a simple 64x64 box that I whipped up in a few seconds. Now lets get started!
First thing's first, you need to set up your materials and create a vmt for them. So for my box, I created 1 texture, and 1 vmt. Open up Notepad, and key in the following, changing the directory, to the one your textures are in:
The VertexlitGeneric tells us that the texture belongs to a model, and the $basetexture tells us the path of said texture. Now save the vmt by going to File>Save As and give it the same name as your vtf file, with the .vmt extension, so in this case, it will be crate.vmt
Now let's get started on the actual model itself.
In order to compile a model, you need the required files above, and you need to create a QC file using notepad. There are various lines of code that you need to type into the qc, in order for your model to compile. Below are all the lines that we will be using, and a little description on each one of them.
$modelname "custom/tutorial/compiletut.mdl
This line is what tells Studiomdl what we want the model to be called, and where we want it to be placed when it is compiled. In this case, the model will be called compiletut.mdl and it will be placed in the models/custom/tutorial directory.
$scale 1.0
This line states the size of the model. You can resize it as much as you want just by editing this line, it saves a lot of time because you don't have to go resize the model in the modeling program. It can be left at the default scale for now.
$staticprop
This small line is what tells the compiler that we are trying to compile a prop_static, and that it doesn't expect any animations in the model. Basically, without this line, it will compile the model as prop_physics.
$body "Body" compiletut.smd
In this line, you state what the name of the reference model is called. So in this case, it is compiletut.smd. Some models might have it as compiletut_ref.smd but it doesn't really matter what it's called.
$surfaceprop "metal"
This line tells the compiler what kind of material the prop is supposed to be. In this case, it is set to metal, so when I go to test it out ingame, it will sound like I'm shooting a metal crate. You can change it to various other materials. For a full list of Material Properties, check out the Valve Wiki.
$cdmaterials "models/custom/tutorial"
This line tells the compiler where the vmt for the texture you created can be found. In this case, my textures are in the materials/models/custom/tutorial folder.
$collisionmodel "compiletut_phys.smd" {
$concave
}
This line is where you state the name of the collision model for your prop. The collision model is that invisible area where the player can't shoot or pass through. Once again, the collision model can be called whatever you desire, I just called mine compiletut_phys to prevent confusion.
$sequence idle "compiletut.smd" fps 15 ACT_IDLE 1
This is the last line in the QC, it is a frame of an animation. If it had no frames, there will be no model, so this creates a frame using the smd you provided as the frame.
If everything is typed into the QC, it should look something like this:
Now, save the QC by going to File>Save As. Give it a name with the extension as .qc, and in the "Save as Type:" Change it from Text Documents (*.txt) to All Files
Once you're done saving, move all your files, (except for materials) to the SourceSDK>bin>ep1>bin folder. I like to put things in that folder, because it is where the compiler is located, and it will be easier for the compiler to find the required files.
Now comes the compiling part. Select the QC file you created earlier, and Drag n Drop it onto StudioMDL. Once done so, a command prompt window should come up for a few seconds and then disappear. Once it disappears, it either means that your model has been compiled, or you something is wrong with it and it failed to compile. To confirm if it has been compiled or not, head over to the directory you stated before in the $modelname line of the QC. Mine was models/custom/tutorial.
If it worked, go ahead and try it ingame or in Model Viewer. This is what my final product looks like:
Thank you for reading my tutorial, if you have any questions, please do not hesitate to PM me or leave a comment.
Welcome to our page! We are a Studio that does customization for any source engine game or Mod, we can do many things that are related to this website, so if you want something done, just request it.
Want To Join?
In order to be accepted, you must be a dedicated and experienced mapper, with a minimum of 2 Expert classed Maps that are your creations.