Author Topic: Does anyone...  (Read 119 times)

0 Members and 1 Guest are viewing this topic.

Offline Roach :3

  • ****
  • Windows UserLinux UserApple User
    View More Badges!

  • Posts: 333
  • Gender: Male
  • Kids on drugs are really fun
  • Respect: +68
Does anyone...
« on: May 10, 2012, 12:07:12 PM »
0
Nvm, found a way, milkshape is being asshole, and i dunno what to do, so if some one could help me I would be thankful.
« Last Edit: May 11, 2012, 04:57:23 AM by Roach :3 »

Offline Alkaline

  • *****
  • Windows User
    View More Badges!

  • Posts: 699
  • Gender: Male
  • Respect: +430
Re: Does anyone...
« Reply #1 on: May 11, 2012, 08:18:57 PM »
+2
There are no known .smd exporters for Milkshape3D to my knowledge.
You can always export your work from Milkshape to XSI/3Ds Max and then export from there.

As for the actual process of porting models to source, this link has all you need: https://developer.valvesoftware.com/wiki/Category:Modeling
That and there are a handful of other videos that help you with the process.

I will summarize the process from my experience. This may overwhelm you at first as it did to me, but giving it time will allow you to accustom to the workflow.


When creating a model, there are two main parts: textures and the actual model

Textures:
In your modeling program, you are able to set the texture of a mesh with a bitmap. !Be sure you learn about UV Mapping (texturing the mesh on a 2D image) as this becomes the most tedious part of making models!
You can use multiple bitmaps on your model, but keep filesize in mind. The name of this bitmap is then used in the name of the final .vtf texture.

In order for the Source Engine to actually use your model, you will need a .vmt to call upon the .vtf and set other properties for your texture.
(Also, the first line of your .vmt will be "VertexLitGeneric" as this is the shader used for models in the source engine.)

Model:
In the 3D modeling program you chose, you can create, compose, or erect any sort of mesh as long as it is composed of triangles (no nurbs and no splines). Keep in mind though, more triangles equals more expensive models.
Be sure to create layers as you work to keep organized!
After you are done creating your model, you shall export at least three .smd files:

<modelname>_reference.smd
This is the mesh you see in-game. This should include the bones and mesh of the model. The bones should be enveloped/skinned to the mesh. If your model is going to be static, you do not need to create any bones, the exporter for your program should automatically create it.

<modelname>_idle.smd
This is an animation of the reference model. When you export this, make sure you put all of the bones in your model onto a single layer as you are only exporting the position and rotation of the bones! You will export all the keyframes of your animation into this file.
The bones I mention are attached to your mesh in some way. How they are attached to the mesh is written in the reference.smd file. A static prop will have one bone that does not move; an animated prop may have multiple bones that control specific vertices in the mesh.
You can have as many animations as you want! Just replace idle in the filename with the name of the animation as this will keep you organized.
Remember, this file (or these files) only show the position and rotation of the bones.

<modelname>_phys.smd
This is the model used by the Source Engine's physics engine when calculating its interactions in the environment. To prevent from having an expensive physics model, make a new layer and create a blocky, low-polygon version of your model.



Now that you have all three of the required files, let's carry on to the bane of modeling in the source engine: compiling the model!

When compiling a model, you will have to create a .qc file. This file is a script run by the program I mention later on.
Open up default wordpad and a save a blank file ending in .qc (e.g. <modelname>.qc to stay organized).
Here is a basic code for compiling a static model:

Code: [Select]
//Comments that begin with "//" will be ignored by the compiler! Read on!
//Be sure you create the folders in the game directory you are using before compiling to avoid errors!!!
//Be sure the .qc is in the same folder as the .smd files when you compile!!!

$modelname "alkaline\<modelname>.mdl"    //this creates the .mdl file in this folder (in the model folder of the game directory you are using)
$body mybody "<modelname>_reference.smd"   //this command sets the .smd reference you created
$staticprop                   //use this command if the final model will be static and have only one bone
$surfaceprop metal                     //this isn't necessary as this is defined in the .vmt of the textures, but can be useful as it overrides the .vmt's surfaceprop command
$cdmaterials "models\alkaline"           //it will look in this folder (in the material folder of your game directory) for the .vtf version of the bitmaps you saved.

$sequence idle "<modelname>_idle.smd"              //the command for adding a sequence; followed by the name of the sequence; followed by the name of the .smd sequence file

$collisionmodel "<modelname>_phys.smd" { $concave }              //this command sets the phys.smd you created as the physical mesh

Now that you have your .qc file you can now load it into a program to compile into a .mdl. You're almost there!
I use a GUI version of studiomdl called GUIStudioMDL: http://www.wunderboy.org/apps/guistudiomdl2.php
Be sure you set up the config so the program will compile your model to the directory of the game you are using. I use HL2:EP2.

Click compile, cross your fingers, and get ready to smash your computer screen inwards when you get an error!

And that's about it!
Open up Model Viewer in the Source SDK and open the .mdl file you compiled as set in the .qc
If you had done everything correctly (even though this summary is very broad and doesn't include a full, in-depth run-through of this process), you should see your model.
You can then put the model inside a map using Hammer.


If anything, I recommend that you first get used to the 3D modeling program you are using. This will help clear any hassle when creating your model and leaves you time to focus on the complex compile process Valve left for the modding community.
I use 3Ds Max 2012 with the Cannonfodder SMD exporter. The interface is ergonomic and, by far, my favorite.
So far, the only issues I have for exporter is the physics model, but GUIStudiomdl creates a shrinkwrapped physics model from the reference model.

Sorry but I only know so much about this process. I still have no clue about hitboxes, blending, gestures, bone weights, jigglebones, and shit ton of other stuff.
Be sure to look at the link I first gave you and use this as a starter's reference.

Good luck to you and anyone else who found this useful!

EDIT:

If anyone needs these for examples or to work off of, I'd be glad to give you the files.
« Last Edit: May 11, 2012, 08:31:17 PM by Alkaline »
A Man named William Reed's last living testament says that he is going to read his own will.

Will Reed's will will read "Will Reed will read Will Reed's will"

Offline Roach :3

  • ****
  • Windows UserLinux UserApple User
    View More Badges!

  • Posts: 333
  • Gender: Male
  • Kids on drugs are really fun
  • Respect: +68
Re: Does anyone...
« Reply #2 on: May 12, 2012, 04:55:49 AM »
0
I don't have any problems any more tbh, I'm not making any models just hexing or whatever you call it (headhacking for me), so my problem is the compiling and the qc coding.