Tutorial : How To Compile Your Model

TresthTresth Join Date: 2002-11-03 Member: 5602Members, Constellation
<div class="IPBDescription">For the general MS3D nubblar</div>Right, it's originally meant for my website *pimpetypimp*<a href='http://mapage.noos.fr/paul.nicol/#tuts' target='_blank'>Tresth's Lair</a>*pimpetypimp* (third tutorial). However, I'll move it to these forums too.
Copy paste, here I come!

-------------------------------------------------------------------------------------------

 Many modelling sites, such as Polycount, propose tutorials on compiling your model to the Half Life engine. However those guides are often 5 pages long and hard to keep the track with.

     That's why I offer you here, a "simple" tutorial on the same subject, using *coughcough* Milkshape 3D, tool of the general nubblar but powerful nonetheless.

     Let's first of all assume you have your model finished and imported in Milshape 3D, either by having it in .ms3d in the first place, or by importing it from 3D Studio Max (or any other modelling software) using the appropriate plugins -- of course if you're experienced enough, you don't even have to export it to Milkshape and save it as .smd directly, but that's another story -- You should have something similar to this picture :

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot1.jpg' target='_blank'>Clickety Click</a> ::

-----------

 We might now want to give that mesh a texture. To do so, you first have to remember that Half Life only supports 8bit texture maps (or 256 colors if you prefer) and those texture also have to be in a 8x8 multiple (8x8, 16x16, 64x64, 128x128, 256x256 and the max 512x512).

     We wil first of all set your viewport so it actually displays the textures maps instead of the flatshaded mesh. Easy stuff, right click on your 3D Viewport and click Textured. Now, we want to select the mesh, even easier, go to Groups, click your group name then Select, your mesh should turn red.
     With the mesh still selected, go to the Materials tab and click New, you can rename the texture if you want by clicking the Rename button. You now want to import the texture itself, click the highlighted button next to "None" in my picture and find your texture. Finally click Assign.

     At the end, you should get something like the second picture to the right (without the wireframe overlay -- Right click on 3D viewport > Wireframe overlay )

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot6.jpg' target='_blank'>Groups</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot7.jpg' target='_blank'>Materials</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot5.jpg' target='_blank'>Set your viewport to textured</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot8.jpg' target='_blank'>You should get this</a> ::

-----------

     Right, let's also assume you DON'T want animations yet, because you have a side animator who knows what he's doing, and you just want to test your skinmesh/[insert random stuff here].

     So we have right here a "naked" model, so we'll have to add him a basic skeleton for your compiling needs. You should know that the compiler won't compile anything boneless, we'll have to "trick" it.

     You first have to go to Joints and check "Show Skeleton", this will allow you to actually see the joints you'll create next instead of clicking around cluelessly ;) Next, go to Model > Joint, and click anywhere on the viewports, preferably inside the mesh itself, so you actually remember what that blue sphere is :p. You should get something like the picture to the last picture

    Remember, if you really feel like it, you can rename your bones in the Joints menu.

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot3.jpg' target='_blank'>Show skeleton</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot2.jpg' target='_blank'>Joints</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot4.jpg' target='_blank'>This!</a> ::

-----------

    We'll now have to assign the vertices to the bone itself. To accomplish that, first go to Groups, click the group name and click Select, next go to the Joints tab, click the bone name, click SelUnAssigned, this will select all unassigned vertices, then Assign -- this will assign all selected vertices to the selected bone. Easy isn't it?

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot10.jpg' target='_blank'>Assign your bones!</a> ::

-----------

 Good, we're halfway done. Now have a big breath and brace yourself, you're going to export your model to a .smd format. This is mainly because you can't "save" your model to .mdl but have to compile it. And the more important part, Half Life uses only smd's to compile the mesh.

     Go to File > Export > Half-Life SMD, go to your directory and give it a name, I called my file level5_ref.smd, you will see why soon enough. Click Save, check Reference, then OK -- this is simple, the reference file is basically what it's name says, it's a mesh and bone reference to all animations, if you change your reference file in any way (regarding bones), you have to redo ALL of your animations, so be warned --

     Next, we'll do exactly the same thing, go to File > Export > Half-Life SMD, give it this an animation name, the best thing to die is to call it idle, since it won't move (remember our crappy bone?). Click Save, check Sequence and finally OK.

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot11.jpg' target='_blank'>Export SMD</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot9.jpg' target='_blank'>Path</a> ::

-----------

     Last step before compiling, the qc file itself! Tools > Half-Life > Generate QC File is the way to go, save it in your smd's and texture folder and give it the final name of your model, in my case, level5.qc. You might want to edit it now, so again Tools > Half-Life > Edit QC File and open your qc file.

    Good, now there are two lines you need to change :

<span style='font-family:Courier'>studio "./reference"
$sequence seq-name "sequence" loop fps 90 ACT_IDLE 1</span>

    Replace ./reference with your reference smd filenamen, here "level5_ref" and seq-name/sequence with the animation name, here "idle". Save and exit.

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot12.jpg' target='_blank'>Click!</a> ::
:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot13.jpg' target='_blank'>Keep clicking!</a> ::

-----------

     Huzzah we're done! Now make sure your qc file, your smd's and your textrues are in the same folder. Final Ftep : Tools > Half-Life > Compile QC File, and select your qc file.

     If you followed all my steps, you should have a nice .mdl file in your qc folder :D

:: <a href='http://mapage.noos.fr/paul.nicol/tuts/compile/shot14.jpg' target='_blank'>Last one, pfew!</a> ::






I hope this tutorial helped you! I'm sorry for the crappy layout, but it wasn't designed for a forum :p

Comments

Sign In or Register to comment.