Creating and Exporting Models in 3Ds Max Difficulty: Beginner |
| Category: SOURCE > Other/Misc | Author(s): Mike |

Creating custom models in 3Ds Max 2009
This tutorial will bring you through every little step it takes to make a simple model in 3Ds Max 2009. For future reference, my model will be called sample_box and the texture I will be using is called box_texture.
Programs and Plugins
3Ds Max SMD Exporter Plugin
3Ds Max VTF Importer Plugin
GUI StudioMDL
VTFEdit
Setting up 3Ds Max
OK, lets get started. Open 3Ds Max. First we have to get the environment set up so that everything that you make here will be exactly as you see it in game. The first step is to change the scale. Source uses a 1 unit to 1" scale.
 
In the toolbar go to Customize -> Units Setup... (third from the right then third from the bottom.)
1. Under Display Unit Scale select US Standard then change the dropdown box underneath to Decimal Inches.
2. Click the System Unit Setup button.
3. Make sure that 1 Unit = 1.0 Inches
4. Click OK
5. Click OK

Now let's set up our grids. You do not have to setup the grids this way but that is how I recommend. This will make it so each grid mark is one inch and every major grid line is one foot.
In the toolbar go to Tools -> Grid and Snap Settings (third from the left then third from the bottom)
1. Click the Home Grid tab.
2. Change Grid Spacing to 1.0"
3. Change Major Lines every Nth Grid Line to 12
4. Change Perspective View Grid Extent to 120
5. Close the window.
6. Click the button.
Creating a Simple Model
Now that we have everything set up we can start making our model. For this tutorial I am going to make a simple box.

1. In the toolbox on the far right click the tab (Create)
2. Click on the that is directly underneath (Geometry)
3. Directly underneath is a dropdown box, make sure it has Standard Primitives selected.
4. Now click the button that reads Box.
5. Move your mouse over the Front perspective (top right) and click and hold and drag out a rectangle. Move your mouse up and down to change the thickness and click again to make the box. Don't worry about the actual size, we will change it later.
We have created a basic box, but lets say we want to make it an exact size of 16"x16"x32"?
1. In the toolbox on the far right click on the tab (Modify).
2. Under the Parameters section change the Length to 16.0", Width to 16.0", and Height to 32.0".
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. 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\
You may want to create a shortcut to this folder on your desktop for quick and easy access.
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 folders don't exist, create them.
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 3Ds Max
Back to 3Ds Max. Now to add textures to our model. Repeat the fallowing for all the textures you want to use. Steps 8-13 Are Very Important!
  
-1. Make sure you have your box selected.
0. In the top toolbox, click the button (Material Editor).
1. In the Material Editor window that pops up, click on the first ball.
2. Click on the small button to the right of Diffuse:.
3. In the list that pops up, double click on Bitmap at the very top.
4. Navigate to materials\models\YourModel\ (For me I would go to materials\models\sample_box\)
5. Open the .VTF of your texture (for me it would be materials\models\sample_box\box_texture.vtf)
6. Right click on the same circle that now has the texture applied to it and select Render Map...
7. Sorry I messed up on my numbering :/ Just go to number 9.
8. Sorry I messed up on my numbering :/ Just go to number 9.
9. In the Render Map window that pops up, change the fields labeled Width: and Height: to the width and height you want your texture to be. They should be a power of 2 (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048...)
10. Click the Files... button.
11. It should be in the right folder but make sure that it is in the same folder as your texture, materials\models\YourModel\ (for me it would be materials\models\sample_box\)
12. Save it as the exact same name as your texture but with a different extension, like .TGA. (For me I would save it as materials\models\sample_box\box_texture.tga) You can use any of the extensions listed in the Save as type: dropdown box. Make sure and include the extension in the File Name or it will not save! For example, if I wanted to save it as a .tga, I would make sure that the File Name DOES NOT read "box_texture" but rather "box_texture.tga"
13. Depending on what extension you chose I different popup may or may not appear. If one does change the settings accordingly and press OK. For example if you saved it as a .JPG a popup with options for changing the quality will appear. If you are like me and saved it as a .TGA a popup will appear with several options. Don't change anything unless you know what you are doing and just press OK.
14. Now back at the Render Map window, click Render.
15. Now back at the Material Editor window, Click the button (show material in view button.)
16. Click the button (assign material to selection button.) Don't worry if your texture looks funky, we will fix that next.
17. Close the Material Editor window.
18. In the right toolbox, click on the tab (Modify.)
19. In the dropdown box that reads Modifier List select UVW Mapping.
20. in the Perimeter section bellow appears a new subsection called Mapping. In this section select Box. This should fix your textures.
Adjusting Angles and Origins
In order to get the angles and relative positions of objects to be correctly compiled, a few steps need to be taken.

1. In the right toolbox, click the tab (Hierarchy.)
2. Press the Pivot button.
3. Press the Affect Pivot Only button.
4. In the top toolbox, click the button (Select and Move.)
5. In the bottom tool box, near the center is a small , click it.
6. To the right of that button you will see three fields labeled X:, Y:, and Z:. Set all of them to 0.0
7. In the top toolbox, click the button (Select and Rotate.)
9. Change the same X:, Y:, and Z: fields to 0.0 again.
10. Click the again.
11. Click the Affect Pivot Only button again.
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 is to export the model as a .SMD We must export both the visual model and the collision model.
1. Select the Box.
2. In the toolbar, go to File -> Export Selected... (far left then near the middle.)
3. In the popup Save File to Export Navigate window, navigate to the compile folder on your desktop.
4. In the field labeled Save as type: select Source SMD (*.SMD).
5. Save the file as your model's name (for me it would be sample_box.smd)
6. In the popup SMD File Exporter window, make sure Export Reference SMD is selected and Export as Half-Life 1 SMD is UNCHECKED, unless you are modeling for Half-Life 1.
7. Press OK
8. The progress of the export is shown. When it finishes Press OK.
9. Make sure the box is still selected. (At this point if you have a collision model that is different than the visual model you should select the collision model.)
10. In the toolbar, go to File -> Export Selected... (far left then near the middle.)
11. In the popup Save File to Export Navigate window, navigate to the compile folder on your desktop.
12. In the field labeled Save as type: select Source SMD (*.SMD).
13. Save the file as your model's name BUT WITH "_collision" added to the end. (for me it would be sample_box_collision.smd)
14. In the popup SMD File Exporter window, make sure Export Reference SMD is selected and Export as Half-Life 1 SMD is UNCHECKED, unless you are modeling for Half-Life 1.
15. Press OK
16. The progress of the export is shown. When it finishes 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 but replace "YourModel" with the name of your model (mine would be sample_box):
$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 File -> Save As... (Far left then in then fourth from the top.)
4. Navigate to the compile folder on your desktop.
5. In the dropdown box labeled Save as type: select All Files.
6. In the field labeled File name: type in "compile.qc"
7. Press Save.
Compiling Your 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-11.

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.
Your 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 Render your textures in 3Ds Max. See the Importing Textures Into 3Ds Max section, steps 8-13
- You did not apply your textures to your model. See the Importing Textures Into 3Ds Max section, step 16.
No collisions:
- You did not create your .SMD file for your collision model. See the Exporting your Model section, steps 9-16.
- You did not compile your collision model. Check you QC file, make sure the line that starts with $collisionmodel reads $collisionmodel "YourModel_physhull.smd" (for me it is $collisionmodel "sample_box_collision.smd")
That's all for now, thanks and good luck! |
| Added: 3 months ago | Tags: 3ds, max, 2009, modeling, models, exporting, importing, mdl, qc, vmt, vtf |
 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. |
 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. This Tutorial in a nutshell... Detailed & Helpful 2 x Detailed 2 x Helpful 2 x Useful 1 x Well Written You cannot stamp yet!Stamps let you apply characteristics to submissions to help others understand them. To stamp this submission register or login.
 |
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 |
Want more? Find related tuts. |