GoldenEye: Source Forums

  • December 22, 2024, 05:37:29 pm
  • Welcome, Guest
Advanced search  

News:

Pages: [1]   Go Down

Author Topic: [Tutorial] Creating a custom model for GE:S - The basics  (Read 12068 times)

0 Members and 1 Guest are viewing this topic.

Luchador

  • Retired Lead Developer
  • 00 Agent
  • *
  • Posts: 387
  • Reputation Power: 175
  • Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!Luchador is awe-inspiring!
  • Offline Offline
    • My Website
[Tutorial] Creating a custom model for GE:S - The basics
« on: January 24, 2011, 11:09:34 pm »

In this tutorial I'm going to demonstrate and explain the procedure I use to make custom models for Goldeneye: Source. Today I'm going to show you how to create a very simple static prop and get it to display correctly in GE:S.

What you'll need:

The first step is to open up 3ds Max. You should see a screen that looks something like this. To navigate the perspective viewport hold down the middle mouse button to pan, alt+middle mouse button to rotate, and scroll wheel to zoom in and out.



Now in the top toolbar go to Create->Shapes->Text. In the 2d viewport labeled "Front" click to make some text. You can change the words and font as you like. The font is Arial in this screenshot but then I changed it to Bank Gothic. Shortcuts: you can enable/disable the grid with 'g' and enable/disable the white bracket things around the text with 'j'.



Now look at the buttons in the upper right corner of 3ds Max. On that top row click the second button from the left. It lets us create modifiers to turn our 2d text in a 3d model. In the drop down box that says "Modifier List" go down to "Shell" and click it. This will give our model some thickness. I made it 4 inches thick. 1 3ds Max unit is about equal to one Hammer unit which is about equal to one inch. If you don't like the color of the model you can press 'm' to bring up the material editor and assign a basic gray to your model. This is optional since we'll be making our own material and texture later.



In the "Perspective" viewport right click on the model and go to Convert To->Convert to Editable Poly.



You should see something like this. You can press 7 to show a counter that displays how many polys and verts the model is using. You can also press F4 to turn the wireframe on and off. It this were a real model for the mod we'd want to optimize it by getting rid of unnecessary polys and dividing the model up into quads and tris. But for this tutorial what I want you to do is press '1'. This takes you into vertex mode. Now using the left mouse button drag a rectangle around the entire model. Look at the right panel that says "Edit Vertices." Click on the "Connect" button to split the model up into a bunch of triangles. Again, this isn't something we'd normally do for a real model, we're just trying to get some results quickly.

Before we move on I'd suggest setting up 3ds Max to autosave your work every few minutes. It does crash sometimes.



Save what you have to far and open up Photoshop.



Go to File->New. Create an image of size 32x32. We're just going to use a solid color texture for this model to keep things simple. Select a golden color and fill up the image with the paint bucket tool. You can use 'control' + '+' to zoom in and 'control' + '-' to zoom out.



Now we need to save the image as a .vtf, the texture format for the Source Engine. If you have the VTF Plugin installed go to File->Save As. If the plugin is installed correctly you can open the format type list and see VTF. Select it and save the name as "goldeneyetext.vtf" You'll want to save it to your mod folder. And for this tutorial we'll put it in the Silo model materials folder. For me that path is: C:\Program Files (x86)\Steam\steamapps\SourceMods\gesource_svn\materials\models\props\silo (if you're a developer for GE:S). Otherwise you'll use the same path except "gesource_svn" will just be "gesource." Once you've done that go to where you saved the texture and make sure it's there and of the .vtf type.



Now open up Notepad++ (or just Notepad).



Code: [Select]
"VertexLitGeneric"
{
//Our Diffuse Texture
"$basetexture" "models/props/silo/goldeneyetext"
//A normal map is required if you want to use Phong shading
"$bumpmap" "models/flatphong_normal"

//Our Phong parameters
"$phong" "1"
"$phongexponent" 10
"$phongboost" "10"
"$phongfresnelranges" "[0.05 0.5 1]"

//Cubemap settings (how reflective the texture is)
"$envmap" "env_cubemap"
"$envmaptint" "[.3 .3 .3]"
"$normalmapalphaenvmapmask" "1"

$model 1
}

Type that code into a new file and save it in the same place you saved your .vtf. Save it as type .vmt. Make sure you are NOT saving it as a .txt.

Now go back into 3ds Max. Open up the material editor with 'm'
Drag your .vtf onto one of the gray spheres. Then with your model selected assign that material to your model with the circled button.



Before we can export our model we need to create a separate collision model. A collision model should be extremely simple and made out of convex shapes. Each shape should have all its faces set to the same smoothing group and each shape should have a unique smoothing group. Usually I just make collision models out of simple boxes or cylinders. To keep things simple we're just going to make our model's collision model a box. Go to Create->Box and create a box that roughly covers the text model. Then right click on the box and convert it to Editable Poly. Then press '5'  to get into element mode (you'll see the red cube on the right highlighted yellow) and in the smoothing groups panel click "Clear All" then click on the '1' button.



We're finally ready to export our model. But before you do open the material editor (m) again and apply the material with the .vtf to the collision model. Every model you export has to have a .vtf material to go with it or the exporter will reject it. Go to the 3ds Max logo on the top left, click it, and go to Export->Export Selected



We save this in the .smd format, which should be available to you given you installed the .smd exporter correctly. Save it into the GE:S models folder. For me this path is C:\Program Files (x86)\Steam\steamapps\SourceMods\gesource_svn\models\props\silo. Again, if you're not a developer, "gesource_svn" will just be "gesource." The file name should be "goldeneyetext_phys" The "_phys" means this is our collision model.



After clicking Save this dialog will come up. Although it doesn't matter for collision models, check "Alternate normals export method" when you export .smd's as this results in superior phong shading quality. The click OK. Another box will show up and export the model. Press OK when it's finished.



Now we need to export two more .smd's. Click the yellow highlighted cube on the right to get out of element mode. Then select our regular text model. This is the model we'll actually see in game. Export it like you did before, but this time save it as "goldeneyetext.smd" After that do it one more time but save it as "goldeneyetext_idle.smd" You should have three .smd files in total. Now we're ready to write the .qc file that will let us compile our model.

Open up Notepad++ again. Open a new file and type in the following. Save it as a .qc in the same folder you saved your .smd's (NOT your .vtf's and .vmt's). Qc files give your model properties such as what material it will be made of, how much it will weigh and if it will be animated.

Code: [Select]
//Our model's name
$modelname props/silo/goldeneyetext.mdl
//Material directory
$cdmaterials "models\props\silo\"

$scale 1

$body studio "goldeneyetext.smd"

//What type of material the model is made of
$surfaceprop "metal"

//Our model isn't animated, so we use $staticprop
$staticprop


$sequence idle "goldeneyetext_idle" loop fps 1

//Our collision model
$collisionmodel "goldeneyetext_phys.smd" {
$automass
$concave
}



In order to compile the model we need to drag and drop our goldeneyetext.smd file onto studiomdl.exe, found in C:\Program Files (x86)\Steam\steamapps\<YourSteamName>\sourcesdk\bin\orangebox\bin. A command prompt will quickly appear and then disappear. The finished model files will appear next to your .smd's and .qc. Now open up the Source SDK. Open Hammer. Open a map. Put in a prop_static. Search the model browser for the model you made. Compile the map. See your custom model! If it's too big or too small you can fix it by changing "$scale 1" to, say "$scale 2" in your .qc file and recompile the model.



That's about the bare minimum it takes to get a model into Source, yet there's still dozens of places to make a silly mistake. If you have questions please ask them!

Kinky

  • Level Designer / Environment Artist
  • Retired Developer
  • 00 Agent
  • ***
  • Posts: 751
  • Reputation Power: 7
  • Kinky has no influence.
  • Offline Offline
Re: [Tutorial] Creating a custom model for GE:S - The basics
« Reply #1 on: January 25, 2011, 12:28:19 am »

VERY nice Luch. Solid tutorial. Hopefully many will learn.
Logged

Currently in Progress - ge_jungle

WNxEuphonic

  • 00 Agent
  • ***
  • Posts: 217
  • Reputation Power: 106
  • WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!WNxEuphonic is awe-inspiring!
  • Offline Offline
    • Euphonic.dev
Re: [Tutorial] Creating a custom model for GE:S - The basics
« Reply #2 on: February 06, 2011, 08:52:11 am »

Once I perfect my texture making maybe I'll move onto modeling. Hahaha, man, I just like the 2D artistry so much.
Pages: [1]   Go Up