This tutorial will bring you through every little step in creating, texturing , exporting, and compiling a model in 3Ds Max to use with the Source Engine.
[title]Creating custom models in 3Ds Max 2009[/title]
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 samplebox and the texture I will be using is called boxtexture.
[title]Programs and Plugins[/title] 3Ds Max SMD Exporter Plugin 3Ds Max VTF Importer Plugin GUI StudioMDL VTFEdit
[title]Setting up 3Ds Max[/title] 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.
[img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/SystemUnitSetup.png[/img][img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/SystemUnitScale.png[/img] In the toolbar go to [u]Customize[/u] -> [u]Units Setup...[/u] (third from the right then third from the bottom.) 1. Under Display Unit Scale select [u]US Standard[/u] then change the dropdown box underneath to [u]Decimal Inches.[/u]
Click the [u]System Unit Setup[/u] button.
Make sure that [u]1 Unit = 1.0 Inches[/u]
Click [u]OK[/u]
Click [u]OK[/u]
[img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/3GridAndSnapSettings.png[/img] 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 [u]Tools[/u] -> [u]Grid and Snap Settings[/u] (third from the left then third from the bottom) 1. Click the [u]Home Grid[/u] tab.
Change [u]Grid Spacing[/u] to [u]1.0"[/u]
Change [u]Major Lines every Nth Grid Line[/u] to [u]12[/u]
Change [u]Perspective View Grid Extent[/u] to [u]120[/u]
Close the window.
Click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/MAGNETIMAGE.png[/img] button.
[title]Creating a Simple Model[/title] Now that we have everything set up we can start making our model. For this tutorial I am going to make a simple box. [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/4RightToolbox.png[/img] 1. In the toolbox on the far right click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/MOUSEIMAGE.png[/img] tab (Create)
Click on the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/BALLIMAGE.png[/img] that is directly underneath (Geometry)
Directly underneath is a dropdown box, make sure it has [u]Standard Primitives[/u] selected.
Now click the button that reads [u]Box[/u].
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 [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/ARCHIMAGE.png[/img] tab (Modify).
- Under the Parameters section change the [u]Length[/u] to [u]16.0"[/u], [u]Width[/u] to [u]16.0"[/u], and [u]Height[/u] to [u]32.0"[/u].
[title]Setting Up Folders[/title] Before we go any further we need to setup our folders. 1. Create a folder on your desktop called "compile".
[b]All directories below are relative to the game[/b]. Examples: HL 2: C:/Program Files/Steam/steamapps/[b]username[/b]/half-life 2/hl2/ CSS: C:/Program Files/Steam/steamapps/[b]username[/b]/counter-strike source/cstrike/ Gmod: C:/Program Files/Steam/steamapps/[b]username[/b]/garrysmod/garrysmod/ You may want to create a shortcut to this folder on your desktop for quick and easy access.
Navigate to [u]/models/[/u] If the folder does not exist, create it.
Create a folder that has the same name as your model.
Navigate to [u]/materials/models/[/u] if either folders don't exist, create them.
Create a folder that is that same name as your model. The model I am using is called samplebox so for me I would create the folders: /models/samplebox/ /materials/models/sample_box/
[title]Converting Textures[/title] 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 boxtexture as my texture in this tutorial. [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/5CreateVMTFile.png[/img] 1. Start VTFEdit.
In the toolbar go to [u]File[/u] -> [u]Import[/u] (Far left then in the middle) or press Ctrl+I.
Open the image you want to use as a texture.
Leave everything the same in the VTF Options window that pops up and click OK.
Go to [u]File[/u] -> [u]Save As...[/u] (Far left then in the middle) or press Ctrl+Shift+S.
Navigate to [u]/materials/models/[b]YourModel[/b]/[/u] and save the image as your desired texture name. (For me I would save it as /materials/models/samplebox/boxtexture.vtf)
Now Go to [u]Tools[/u] -> [u]Create VMT File[/u] (third from the right then at the very top.)
In the Create VMT File Window that pops up, click the [u]Options[/u] tab.
In the dropdown menu labeled [u]Shader:[/u] select [u]VertexlitGeneric[/u].
Click the [u]Create[/u] button.
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/samplebox/boxtexture.vmt)
In the popup that asks you if you want to replace the existing file, click [u]Yes[/u].
Click [u]Close[/u].
[title]Importing Textures Into 3Ds Max[/title] Back to 3Ds Max. Now to add textures to our model. Repeat the fallowing for all the textures you want to use. [b][u]Steps 8-13 Are Very Important![/b][/u] [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/6MaterialEditor.png[/img][img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/8RightToolbox2.png[/img][img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/7RenderMap.png[/img] -1. Make sure you have your box selected.
In the top toolbox, click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/MATERIALIMAGE.png[/img] button (Material Editor).
In the Material Editor window that pops up, click on the first ball.
Click on the small button to the right of [u]Diffuse:[/u].
In the list that pops up, double click on Bitmap at the very top.
Navigate to [u]/materials/models/[b]YourModel[/b]/[/u] (For me I would go to /materials/models/sample_box/)
Open the .VTF of your texture (for me it would be /materials/modelss/amplebox/boxtexture.vtf)
Right click on the same circle that now has the texture applied to it and select [u]Render Map...[/u]
Sorry I messed up on my numbering :/ Just go to number 9.
Sorry I messed up on my numbering :/ Just go to number 9.
In the Render Map window that pops up, change the fields labeled [u]Width:[/u] and [u]Height:[/u] 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...)
Click the [u]Files...[/u] button.
It should be in the right folder but make sure that it is in the same folder as your texture, /materials/models/[b]YourModel[/b]/ (for me it would be /materials/models/sample_box/)
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/samplebox/boxtexture.tga) You can use any of the extensions listed in the [u]Save as type:[/u] dropdown box. [b]Make sure and include the extension in the File Name or it will not save![/b] For example, if I wanted to save it as a .tga, I would make sure that the File Name DOES NOT read "boxtexture" but rather "boxtexture.tga"
Depending on what extension you chose I different popup may or may not appear. If one does change the settings accordingly and press [u]OK[/u]. 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 [u]OK[/u].
Now back at the Render Map window, click [u]Render[/u].
Now back at the Material Editor window, Click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/SHOWTEXIMAGE.png[/img] button (show material in view button.)
Click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/APPLYTEXIMAGE.png[/img] button (assign material to selection button.) Don't worry if your texture looks funky, we will fix that next.
Close the Material Editor window.
In the right toolbox, click on the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/ARCHIMAGE.png[/img] tab (Modify.)
In the dropdown box that reads [u]Modifier List[/u] select [u]UVW Mapping[/u].
in the [u]Perimeter[/u] section bellow appears a new subsection called [u]Mapping[/u]. In this section select [u]Box[/u]. This should fix your textures.
[title]Adjusting Angles and Origins[/title] In order to get the angles and relative positions of objects to be correctly compiled, a few steps need to be taken. [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/9RightToolbox3.png[/img] 1. In the right toolbox, click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3dstut/HIIMAGE.png[/img] tab (Hierarchy.)
Press the [u]Pivot[/u] button.
Press the [u]Affect Pivot Only[/u] button.
In the top toolbox, click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/MOVEIMAGE.png[/img] button (Select and Move.)
In the bottom tool box, near the center is a small [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/RELIMAGE.png[/img], click it.
To the right of that button you will see three fields labeled [u]X:[/u], [u]Y:[/u], and [u]Z:[/u]. Set all of them to [u]0.0[/u]
In the top toolbox, click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/ROTIMAGE.png[/img] button (Select and Rotate.)
Sorry I messed up on my numbering :/ Just go to number 9.
Change the same [u]X:[/u], [u]Y:[/u], and [u]Z:[/u] fields to [u]0.0[/u] again.
Click the [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/RELIMAGE.png[/img] again.
Click the [u]Affect Pivot Only[/u] button again.
[title]Collision Models[/title] 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.
[title]Exporting Your Model[/title] 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.
In the toolbar, go to [u]File[/u] -> [u]Export Selected...[/u] (far left then near the middle.)
In the popup Save File to Export Navigate window, navigate to the [u]compile[/u] folder on your desktop.
In the field labeled [u]Save as type:[/u] select [u]Source SMD (*.SMD)[/u].
Save the file as your model's name (for me it would be sample_box.smd)
In the popup SMD File Exporter window, make sure [u]Export Reference SMD[/u] is selected and [u]Export as Half-Life 1 SMD[/u] is UNCHECKED, unless you are modeling for Half-Life 1.
Press [u]OK[/u]
The progress of the export is shown. When it finishes Press [u]OK[/u].
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.)
In the toolbar, go to [u]File[/u] -> [u]Export Selected...[/u] (far left then near the middle.)
In the popup Save File to Export Navigate window, navigate to the [u]compile[/u] folder on your desktop.
In the field labeled [u]Save as type:[/u] select [u]Source SMD (*.SMD)[/u].
Save the file as your model's name BUT WITH "collision" added to the end. (for me it would be samplebox_collision.smd)
In the popup SMD File Exporter window, make sure [u]Export Reference SMD[/u] is selected and [u]Export as Half-Life 1 SMD[/u] is UNCHECKED, unless you are modeling for Half-Life 1.
Press [u]OK[/u]
The progress of the export is shown. When it finishes Press [u]OK[/u].
[title]Creating a .QC File[/title] 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
- 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 }
Go to [u]File[/u] -> [u]Save As...[/u] (Far left then in then fourth from the top.)
Navigate to the [u]compile[/u] folder on your desktop.
In the dropdown box labeled [u]Save as type:[/u] select [u]All Files[/u].
In the field labeled [u]File name:[/u] type in "compile.qc"
Press [u]Save[/u].
[title]Compiling Your Model[/title] 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. [img]http://i273.photobucket.com/albums/jj216/yo1dog/3ds_tut/10GUIStudioMDL.png[/img] 1. Run GUIStudioMDL
Press [u]OK[/u] to the popup.
In the toolbar, go to [u]Config[/u] -> [u]Set EP1 Tools Path...[/u]
In the popup [u]Browse For Folder[/u] Window, navigate to [u]C:/Program Files/Steam/steamapps/[b]YourSteamUserName[/b]/sourcesdk/bin/ep1/bin/[/u] replacing YourSteamUsername with the username you use to log into Steam (mine would be yo1dog.)
Press [u]OK[/u]
If you get an error message about "gameinfo.txt", ignore it and press [u]OK[/u] This just means that you don't have any games that use that engine.
In the toolbar, go to [u]Config[/u] -> [u]Set OrangeBox Tools Path...[/u]
In the popup [u]Browse For Folder[/u] Window, navigate to [uC:/Program Files/Steam/steamapps/[b]YourSteamUserName[/b]/sourcesdk/bin/orangebox/bin/[/u] replacing YourSteamUsername with the username you use to log into Steam (mine would be yo1dog.)
Press [u]OK[/u]
If you get an error message about "gameinfo.txt", ignore it and press [u]OK[/u]. This just means that you don't have, or it could not find any games that use that engine.
In the middle of the window, in the [u]SDK[/u] 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.
On the left of the window, in the [u]Target Mod[/u] section, select your game from the dropdown list. If it is not there click the [u]Add[/u] button to the right and navigate to the game's folder. Some examples: HL 2: C:/Program Files/Steam/steamapps/[b]username[/b]/half-life 2/hl2/ CSS: C:/Program Files/Steam/steamapps/[b]username[/b]/counter-strike source/cstrike/ Gmod: C:/Program Files/Steam/steamapps/[b]username[/b]/garrysmod/garrysmod/
In the toolbar go to [u]File[/u] -> [u]Load QC File...[/u] (far left then very top.)
Navigate to the [u]compile[/u] folder on your desktop and open the [u]compile.qc[/u] file.
Click the [u]Compile[/u] button.
Your Done! Congrats! You can use the Source SDK Model Viewer to view your model! It will be located in the [u]/models/YourModel/[/u] folder (for me it is /models/sample_box/[/u])

[title]Errors:[/title] No model in the folder: - You have the wrong location in your .QC file. Check the line in your QC file that starts with [u]$modelname[/u]
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 [u]/materials/models/YourModel/[/u] 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 [u]Converting Textures[/u] section, steps 7-12.
Invisible Model: - You did not Render your textures in 3Ds Max. See the [u]Importing Textures Into 3Ds Max[/u] section, steps 8-13 - You did not apply your textures to your model. See the [u]Importing Textures Into 3Ds Max[/u] section, step 16.
No collisions: - You did not create your .SMD file for your collision model. See the [u]Exporting your Model[/u] section, steps 9-16. - You did not compile your collision model. Check you QC file, make sure the line that starts with [u]$collisionmodel[/u] reads [u]$collisionmodel "YourModelphyshull.smd"[/u] (for me it is $collisionmodel "samplebox_collision.smd")
That's all for now, thanks and good luck!






