Help Wanted
Skinner @ NT Studios (See All)
Search
Username:
Password:
Register or Reset Password
Remove the ads!
  
Creating and Exporting Models in MilkShape 3D
Difficulty: Beginner
Category: SOURCE > Other/MiscAuthor(s): Mike
Did you create this? Request ownership

Creating and Exporting Models in Milkshape 3D

This tutorial will bring you through every little step in creating and exporting models in Milkshape 3D for use with the source engine. For future reference, my model will be called “sample_box” and the texture I will be using is called “box_texture”.


Programs

GUI StudioMDL
VTFEdit


Creating a Simple Model

We will start by making a simple box model in Milkshape.

1. Start Milkshape.



2. In the right toolbox, press the Box button.
3. In one of the views, click and drag a box.


Assigning Bones

In order to export the model, Milkshape requires that all vertices are assigned to a bone or “joint”.



1. In the right toolbox press the Joint button.
2. In one of the views, click near the center of the box.



3. In the right toolbox press the Select button.
4. Below, press the Group button.
5. Click on your box in one of the views. It should turn red meaning that it is selected.



6. Press the Joints tab.
7. In the space directly below, make sure that joint1 is selected. If the space is empty, you did not create your joint; See steps 1-2.
8. Press the Assign button.
9. To make sure that it correctly assigned all the vertices, press the SelAssigned button. All of the corners, or “vertices”, of your box should turn red. If they do not, you did not select your box correctly or you did not assign your box to the joint; See steps 3-8.


Setting up Folders

Before we go any further we need to setup our folders.

1. Create a folder on your desktop called "compile".

All directories below are relative to the game. You may want to create a shortcut to this folder on your desktop for quick and easy access. Examples:
HL 2: C:\Program Files\Steam\steamapps\username\half-life 2\hl2\
CSS: C:\Program Files\Steam\steamapps\username\counter-strike source\cstrike\
Gmod: C:\Program Files\Steam\steamapps\username\garrysmod\garrysmod\

2. Navigate to models\ If the folder does not exist, create it.
3. Create a folder that has the same name as your model.
4. Navigate to materials\models\ if either folder doesn’t exist, create it.
5. Create a folder that is that same name as your model.

The model I am using is called sample_box so for me I would create the folders:
models\sample_box
materials\models\sample_box


Converting Textures

Time to convert your textures into Valve Texture Format (.VTF) and create a .VMT file so that they can be used. Do the following with all the textures you want to use in your model. Remember, I am going to be using box_texture as my texture in this tutorial.

1. Start VTFEdit.
2. In the toolbar go to File -> Import (Far left then in the middle) or press Ctrl+I.
3. Open the image you want to use as a texture.
4. Leave everything the same in the VTF Options window that pops up and click OK.
5. Go to File -> Save As... (Far left then in the middle) or press Ctrl+Shift+S.
6. Navigate to materials\models\YourModel\ and save the image as your desired texture name. (For me I would save it as materials\models\sample_box\box_texture.vtf)
7. Now Go to Tools -> Create VMT File (third from the right then at the very top.)



8. In the Create VMT File Window that pops up, click the Options tab.
9. In the dropdown menu labeled Shader: select VertexlitGeneric.
10. Click the Create button.
11. Save it as the same name as your texture. There will already be one there, this was automatically created when you saved your .VTF, save over it. (For me I would save it as materials\models\sample_box\box_texture.vmt)
12. In the popup that asks you if you want to replace the existing file, click Yes.
13. Click Close.

Importing Textures into Milkshape

Back to Milkshape. Now to add textures to our model. Repeat the fallowing for all the textures you want to use.

1. In the right toolbox, click the Model tab.
2. Make sure the Select button is pressed.
3. Make sure the Group button is pressed.
4. Click on your box in one of the views. It should turn red meaning that it is selected.



5. Back in the right toolbox, click the Materials tab.
6. At the bottom, click the New button.
7. In the middle, click on the first long button that reads , NOT the smaller one that reads “None”.
8. Navigate to materials\models\YourModel\ (For me I would go to materials\models\sample_box\)
9. Open the .VTF of your texture (for me it would be materials\models\sample_box\box_texture.vtf)
10. Click Assign (don’t worry if nothing changes, we’ll fix that next.)
11. Right-click anywhere in the 3D view and select Textured (fourth from the top.)


Collision Models

For an object to be solid, it must have a collision model. This model tells the game where the object should collide with the world and other props. Usually the collision model is a copy of the visual model, but has less detail. This is because a perfect collision model is unnecessary and can be very slow. For example, if you made a sphere with 64 sides, you would copy the sphere, but reduce the sides to around 32 for the collision model. Although the collision model is invisible, it still must have a texture applied to it. Because we only have a simple box, we can use the visual model as the collision model as well.


Exporting Your Model

All that is left to do in Milkshape is to export the model as a .SMD We must export both the visual model and the collision model. Make sure and save your work before proceeding.

1. If you have a collision model that is different than your visual model, delete the collision model. Don’t worry, we will undo this latter but you might want to save before deleting anything.
2. In the toolbar, go to File -> Export -> Half-Life SMD… (far left then near the middle then very top.)
3. In the popup Save File window, navigate to the compile folder on your desktop.
4. Save the file as your model's name (for me it would be sample_box.smd)



5. In the popup SMD Export Window, make sure Reference is selected and the checkbox is NOT checked and press OK.
6. Even if your visual model is the same as your collision model, you need to fallow these last steps. If you have a collision model that is different than your visual model, press Cntrl+Z to undo the delete and get your collision model back. Now select and delete your visual model.
7. In the toolbar, go to File -> Export -> Half-Life SMD… (far left then near the middle then very top.)
8. In the popup Save File window, navigate to the compile folder on your desktop.
9. Save the file as your model's name BUT WITH _collision added to the end. (for me it would be sample_box_collision.smd)
10. In the popup SMD Export Window, make sure Reference is selected and the checkbox is NOT checked and press OK.


Creating a .QC File

We must now make a .QC file to tell the compiler how to compile the model and to define the model's properties. Below I give an example .QC file for my example box model. A list of all available commands can be found HERE.

1. Open Notepad
2. Paste in the following:

$modelname "YourModel/YourModel.mdl"
$cdmaterials "models/YourModel"

$scale 1.0
$surfaceprop "Metal"

$body "Body" "YourModel.smd"

$sequence "idle" "YourModel.smd" fps 30

$collisionmodel "YourModel_collision.smd"
{
$mass 40
}

3. Go to Edit -> Replace... (second from the left then fourth from the bottom) or press Cntrl+H.



4. In the popup Replace window, in the field labeled Find what: type in “YourModel”
5. In the field labeled Replace with: type in the name of your model (for me it would be sample_box)
6. Click Replace All.
7. Go to File -> Save As... (far left then fourth from the top.)
8. Navigate to the compile folder on your desktop.
9. In the dropdown box labeled Save as type: select All Files.
10. In the field labeled File name: type in "compile.qc"
11. Press Save.


Compiling Our Model

The final step! All that is left is to compile the model using the .QC and .SMD files! If you have compiled models before you do not need to do steps 2-10.




1. Run GUIStudioMDL.
2. Press OK to the popup.
3. In the toolbar, go to Config -> Set EP1 Tools Path...
4. In the popup Browse For Folder window, navigate to C:\Program Files\Steam\steamapps\YourSteamUserName\sourcesdk\bin\ep1\bin replacing YourSteamUsername with the username you use to log into Steam (mine would be yo1dog.)
5. Press OK.
6. If you get an error message about "gameinfo.txt", ignore it and press OK. This just means that you don't have any games that use that engine.
7. In the toolbar, go to Config -> Set OrangeBox Tools Path...
8. In the popup Browse For Folder window, navigate to C:\Program Files\Steam\steamapps\YourSteamUserName\sourcesdk\bin\orangebox\bin replacing YourSteamUsername with the username you use to log into Steam (mine would be yo1dog.)
9. Press OK.
10. If you get an error message about "gameinfo.txt", ignore it and press OK. This just means that you don't have, or it could not find any games that use that engine.
11. In the middle of the window, in the SDK section, select if your game uses the Episode 1 or Orange Box engine. Episode 1 Engine includes games like HL2, HL2 EP1, CSS, Gmod 9, TF1, etc. OrangeBox includes games like HL2 EP2, Gmod 10 (I think), TF2, etc.
12. On the left of the window, in the Target Mod section, select your game from the dropdown list. If it is not there click the Add button to the right and navigate to the game's folder. Some examples:
HL 2: C:\Program Files\Steam\steamapps\username\half-life 2\hl2\
CSS: C:\Program Files\Steam\steamapps\username\counter-strike source\cstrike\
Gmod: C:\Program Files\Steam\steamapps\username\garrysmod\garrysmod\

13. In the toolbar go to File -> Load QC File... (far left then very top.)
14. Navigate to the compile folder on your desktop and open the compile.qc file.
15. Click the Compile button.
16. If you get the error:
SteamStartup() failed: SteamStartup(0xf,0x0012F1A8) failed with error 108: The local Steam Service is not running
you need to start steam.


Finished!

You’re Done! Congrats! You can use the Source SDK Model Viewer to view your model! It will be located in the \models\YourModel\ folder (for me it is \models\sample_box)




Errors

No model in the folder:
- You have the wrong location in your .QC file. Check the line in your QC file that starts with $modelname

Black and purple checkered texture:
- You do not have your textures in the right place. Make sure that you have BOTH the .VTF and .VMT in the materials\models\YourModel\ folder (for me it is materials\models\sample_box\)
- You did not make your .VMT
If there are no .VMT files with your .VTF files, see the Converting Textures section, steps 7-12.

Invisible Model:
- You did not apply your textures to your model. See the Importing Textures Into Milkshape section, step 10.

No collisions:
- You did not create your .SMD file for your collision model. See the Exporting your Model section, steps 6-10.
- You did not compile your collision model. Check the line in your QC file that starts with $collisionmodel
Added: 3 months agoTags: modeling, milkshape, smd, mdl, export, vmf, vmt
Feedback (2)
yo1dog .
ASDF - ZXCY2M
Posted 3 months ago
Thanks for the comments and favorite!
Disturbed217 .
I can hear the voicesY2M
Posted 3 months ago
Very nice tutorial

I might get into modeling now.

Thanks for the tut
Add Feedback
Provide constructive feedback. What is "constructive"?
You cannot post yet!
Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop.

To post in this submission register or login.
Assessment
The community's verdict.
User Rating [+]
10/10
bScore
10.0/10
You cannot assess yet!
Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure.

To vote on this submission register or login.
Stamps
This Tutorial in a nutshell...
Helpful & Useful
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.

Brought to you by...
GamerLine Studio
We create quality for you!
Membership: On Request
Primary Skills: 3D Animation, 3D Art & Rendering, Coding/Scripting, Compiling, Concept Art, Graphic Design, Mapping, Modelling, Motion Graphics, Project Management, Sound Effects & Music, Texturing, Web Development
Inception: 1 year ago
Vote for Studio
Like this tut? Vote GamerLine Studio for one or more monthly awards.
You must login or register to access this!
Related Tutorials