How to Compile a .MDL

- By MBD
This tutorial was last updated on Feb 26, 2006.

---
Introduction
---

I will assume you have made your model, assigned all the vertex points to a bone, textured every face, and if needed, animated it. You now just have a model that only works with the modeling programs. Congratulations, the easy part is done. Just kidding. This is a somewhat simple process. We need to compile that model into a file format the Source engine and understand. This file format would be .MDL. Along with the .MDL, other files will be created. These are just as important, and deal with Physics, DirectX levels, etc.

---
SMD, No this isn't a new fetish trend.
---
To accomplish this, we need to convert what ever file model you have, into a file the MDL Compiler, known as StudioMdl, can read and successfully compile. The file format we are aiming for is the .SMD file format. Of course, we are all using different types of programs, but for the tutorial, I'll show you how to use the 3 most popular to my knowledge.

XSI: File -> Export to .SMD

3DSMax: Download the .SMD plug-in for 3DSMax from
http://www.chaosincarnate.net/cannonfodder/cftools.htm
And use the plug-in from there.

Milkshape: With the new version out, you can texture with Sources texture file types, and export to the correct .SMD version. All you need to do is go to File -> Export -> Half-Life SMD...

If this is a Reference model, or a collision model, or if you just want a normal static/physics model with no animation, just click Reference. If this is just the bones moving around in an animation, click Sequence. Click the nice With One Vertex Weigh (HL2) box as well. Click okay, and were done...but, we can't compile just yet. Sorry.

---
New season of the QC on Fox this Fall!
---

And just like all of Fox's other late night programs, this is filled with just as much poor entertainment that you get to sit through. We need to make another file that tells the compiler how to compile the SMD file. This file format is called .QC. I personally, hate this part. But luckily for you, I have a basic Fill-In-The-Blanks .QC for you.

Note, everything in the brackets and bold are there for you to understand where you being/end the folder extensions, or comments. Delete them before saving!


$modelname [hl2dm/models/]Folder-For-Organization,-Not-Needed/ModelName.mdl
$cdmaterials [hl2dm/materials/]Folder-Materials-Are-In[/Texture-Used.vtf]
$staticprop
$scale 1.0
$body studio "NameOfRefrenceSMD"
[You can just use a Reference SMD if you are using a static prop]
$sequence idle "NameOfSequenceSMD" loop fps 15
[Now if you want your model to be solid, use this. You can make a low
polygon version of your model to help with the physics engine, or if
your model is already low on the polygon count, you can use the reference
SMD file already]

$collisionmodel "NameOfCollisionSMD.smd" {
     [Mass in Kg. Density*Volume = Mass, Or make it easy and use $automass
      in place of $Mass]

     $Mass 100
   $concave
}


And thats about it for a basic QC. Save it right next to your SMD file.

---
For once in your life, a quick compile.
---
Now make sure you have Steam open and SourceSDK is set to the correct mod.

Open an Explorer window, or whatever program you use to search though out your computer, and go to the folder holding your .SMDs and .QC files. Open another window, and go to your ...Steam\SteamApps\Username\sourcesdk\bin Folder. You should see a Studiomdl.exe program in there all you need to do is drag and drop your .QC file in there, and pray. Yes, pray to whatever God you believe in. Or pole in the ground. Or whatever. If all goes well, you should have nice model files in your MODFOLDER/Models/What-Ever-Organization-Folder-You-Typed-If-You-Did-If-Not-Ignore-This-Spam/ folder.

Click on the .MDL folder, open with Model Viewer in the ...Steam\SteamApps\Username\sourcesdk\bin Folder. If there are Purple and Black checkers on it, your $cdmaterials string in the QC file is incorrect, or the texture it self isn't correct, or something along both lines were edited or mistyped. I mentioned this as I've received questions on why this happens. And oh its happened to me so many times before. Simple mistakes happen.


Congratulations, you have created a simple model. Open hammer, slam a prop_static entity in the world map. Select and press Alt + Enter. Click on World Model. Click on Browse. Find your model and double click. Apply, and look at the hotness.



Still need help? Ask your questions in one of our HELP FORUMS
Post A Comment
Name:
Email: Links Not Allowed In Comments
Comment:
What is the capital of France? Need Help?
Comments
Raeven0 - Feb 16, 2006
Xellos, MBD (EditLife's modeler) doesn't have a working keyboard right now and can't help you. I am not a modeler and so don't understand the problem; but does the person who answered with that want you to make multiple models?
Xellos - Feb 14, 2006
Sorry if this doesn't bellong here(and sorry for my english), but I have a problem. I gave question about very hi-poly model and I recieved this answer: "You could break it up into separate $model statements." Does anzone know what to do?
All original content ©2006 EditLife.net. All Rights reserved. All files property of their rightful owners.
Get Firefox! Get Thunderbird! Get Notepad++!