Go Back   Steam Users' Forums > Steam Game Discussions > T - Z > Team Fortress 2 > Community Content / Contribution Project > Other

Reply
 
Thread Tools Display Modes
Old 01-13-2010, 09:54 PM   #1
Mnemo
 
 
 
Join Date: Sep 2009
Reputation: 1151
Posts: 1,186
Beginner's Guide to Custom Hat Models

Hello. I've written this guide in an effort to present a glossary of everything you need to know about importing a custom hat into Source regardless of your modeling experience. While this tutorial is geared specifically towards making hats, most of the information here can be applied to creating custom weapons/props/anything. If you need help, feel free to PM me or, better yet, simply ask for it in this thread. There is also a Troubleshooting section at the bottom of this post with some solutions to many of the common issues you're likely to face.

Preparations
Before you get started, you must get organized. Create a folder on your desktop to house all of your projects and materials. Name it "TF2 Stuff" or something like that. Inside that, make one folder for your hats and another for your decompiled reference models (just call it Models). It's also best to have a shortcut somewhere to your tf folder located at C:\Program Files\Steam\steamapps\(your username)\team fortress 2\tf\. You will be visiting there often. The hat we will be making today is going to be giant eyeball for the Demoman so make another folder in your hat folder called "Eyeball".

If you do not have the Source SDK already, get it now. You can find it under the Tools tab in Steam. The Model Viewer is invaluable.

Decompiling
NOTE: Since the character Source files were officially released, you do not need to follow this method to obtain decompiled models for any of the nine classes. Rather, you can find them in C:\Program Files\Steam\steamapps\(your username)\sourcesdk_content\tf\modelsrc\player, already converted to smd format. You can skip this step for now but if you wish to decompile other models such as hats, props or weapons, you must do it manually.
Programs you need:
GCFScape
MDL Decompiler (Place in sourcesdk\bin\ep1\bin)
Notepad++

What we're going to do here is extract the Demoman model from Source and decompile so we can import it into our modeling program and use it as a reference to build a hat around. This is a very important step because without a reference, we won't be able to shape or size it right, let alone fit it on his head. Firstly, make a folder inside your Models folder called "Demoman". Then, make three new folders inside that called "mdl/smd/vtf". Mdl is for the original models, smd is for the decompiled models and vtf is for the materials and textures (should you ever want them). You can keep them all in one folder but it might get messy later on.

Open up GCFScape and find your way into the "team fortress 2 materials" file in steamapps. Click tf>models>player and extract the seven demo files into your Demoman mdl folder. You can also use GCFScape to find materials and look through the source files anytime you like. For now, though, we are done with it.

Go into your mdl folder, right click demo.mdl and choose "Edit with Notepad++". On the very first line, you should see IDST0. Change the 0 to a comma and it should become "IDST,". Save it and open the MDL Decompiler. Type in demo.mdl with it's full address on the first line. On the second line, put in the address for the Demoman smd folder and click extract. Don't check any boxes. You should now have a ton of SMD files and with this, we are done decompiling.

Modeling
Programs you need:
3DS Max/Maya/XSI/Blender/Milkshape/Gmax/Etc
SMD Importer/Exporter (for 3DS Max)
SMD Importer/Exporter (for Blender)

There are a few different modeling programs out there. I would recommend 3DS Max as it's what I use and I believe it's the best program around. It's very expensive ($3,500) but there are ways to get it cheaper if you are a student. I believe there is also a free trial available after completing a short survey. Some of the other programs are entirely free and you should take the time to decide on exactly what you want.

After you've found a program you like and installed the appropriate SMD Importer plugin, it's time to get to work. Open up your modeling program, import demo_morphs_low.dmx.smd from your Demoman smd folder and make sure you check "Convert from left handed coordinate space" so that he stands up straight. You can leave the bones in for now although you would usually import without them (they're distracting).

I won't teach you how to model. I couldn't if I tried. There are tons of tutorials on the internet that can teach you how to use different tools and make different objects. It's an ongoing process like learning how to draw or play an instrument. I can say that if you have 3DS then there is a useful tutorial in the Help section that shows you how to make a viking helmet. Play around with it for awhile and learn a little about the user interface until you are ready to continue.

Make a plain sphere and move/scale it so that it fits over the Demoman's head nicely. There's your model.

Related Links
3DS Modeling Tutorial - A series of introductory videos to modeling in 3DS Max.
Blender Modeling Tutorial - A comprehensive beginner's guide to modeling in Blender.

UVW Unwrapping

UVW Mapping, like modeling, is a difficult process that you must learn on your own time. For now, we need to deconstruct the model so that we may add a texture. We do this by splitting up the model into different pieces and laying them out on a flat surface that we overlay with an image. Add a "UVW Unwrap" modifier from the drop-down list, click the + symbol and choose face selection (http://img684.imageshack.us/img684/6301/tutorial1o.jpg). Highlight the entire front area of the sphere evenly and click on "Pelt". Repeat the process for the back end of the sphere so that you have two pieces stretched out in a little window titled "Edit UVWs". Scale both pieces down so that they are roughly the same size and can still fit within the blue box in the center of the window (http://img207.imageshack.us/img207/7611/tutorial2t.jpg).

At the top of the same window, click "Tools > Render UVW Template > Render UVW Template" and save as a bmp file in your Eyeball folder. Hurray!

Texturing

Programs you need:
Photoshop or Paint.NET
VTF Plugin (for Photoshop)
VTF Plugin (for Paint.NET)
VTF Plugin (3DS Max)
VTF Edit
Open up Photoshop or a similar program and open the file you just saved. Everything within the green lines will show up on the model. The empty black space is irrelevant so don't worry about coloring in the lines (http://img27.imageshack.us/img27/8021/tutorial3a.jpg). Draw the best eye you can and export as a VTF into C:\Program Files\Steam\steamapps\(your username)\team fortress 2\tf\materials\models\player\items\demo. Check No Mipmap and No Level of Detail. Open the VTF with VTF Edit and choose "Tools > Create VMT File" and create it in the same demo folder. The VMT decides things like reflectiveness and translucency. An easy way to create a detailed VMT without learning all of the commands is to go into GCFScape, think of an official Valve hat that looks similar to what you want, find and open the corresponding VMT file, copy the contents, paste them into your own VMT and change the file path at the top.

Now go back into your modeling program, select your model and press M to open the materials window. Click the box next to diffuse, choose bitmap and find the vtf you made earlier. Hit the "Assign Material to Selection" and "Show Standard Map in Viewport" buttons to apply the texture (http://img20.imageshack.us/img20/2066/tutorial4o.jpg).

Related Links
Texturing for Team Fortress 2 - A guide on how to recreate the TF2 art style in your textures.
AO Bake Tutorial - Ambient Occlusion. Essential for creating a great texture.

Exporting
Delete the Demoman model and every single bone except for bip_head. Select the sphere, add a "Skin" modifier using the drop-down list, click "Add" and double-click bip_head. Now the bone is attached to the model. Export the model into your Eyeball folder as an SMD.

Compiling
Programs you need:
GUI StudioMDL
Now you need an idle file. Extract an official Valve hat the same way you did with the Demoman model earlier on. When you decompile, it should have a file called "idle.smd". Copy this into your Eyeball folder.

Now you need a qc file. To save time, just copy the code from this pastebin link into a new text document and figure out the rest later. Make sure you edit the first line to match your own files. Save it as "eyeball.qc" into your Eyeball folder using Notepad++. http://pastebin.com/f2e66b65a

GUI StudioMDL can be frustrating the first time you use it. Can't help you there. When you figure it out, load up eyeball.qc into the program. Choose Orange Box, set the game to TF2 and compile.

The good news? You're finally done and a custom model YOU created now replaces the Ghastly Gibus for the Demoman. The bad news? It's butt-ugly. Make something better. http://img34.imageshack.us/img34/8241/tutorial5d.jpg

Recommended Websites & Tutorials:

Valve Developer Community - General Source wiki, extremely useful information on qc commands, vmt commands, jigglebones and much more.
Assorted Tutorials - A collection of modeling tutorials compiled by Campin Carl on Facepunch.
Anti-Aliasing in HLMV Tutorial - High quality models for the Source SDK Model Viewer. Trust me, you want this.
Jigglebones Tutorial - A video detailing ways to give your model organic movement in the Source Engine.

Troubleshooting
Can't find the decompiled models in sourcesdk_content\tf\modelsrc\player.
If you've just installed the SDK, you need to launch it at least once for the files to appear. If you've had the SDK since before the character source files were released, you must refresh SDK content.

When compiling, an error occurs: "WARNING: Leaking 1 elements"
This happens when either your file name is different in the .qc or the file is not present in the same directory as the .qc. Are your qc and and smd files both in the same folder? If yes, right click your smd and see that it's location matches the first line of the qc.

When compiling, an error occurs: "(Check for write enable)"
Studiomdl won't create folders that don't exist; you must manually create a path to your .mdl before compiling.

Compiling worked but the model appears invisible in-game.
The problem is with your vmt. Make sure it is in the correct folder as determined by the qc and that the first line when you open the vmt reads: "VertexLitGeneric"

The model appears in-game, but without a texture.

There are three possible reasons for this to happen:
1) The texture wasn't applied to the model before exporting.
2) The texture wasn't in the correct folder when exporting and was moved afterwards.
3) The file path in the vmt doesn't correctly lead to the vtf.


http://www.kathar.net/hl2modding/errors.php - A more comprehensive list of errors and solutions.

Last edited by Mnemo: 01-06-2011 at 10:37 AM.
Mnemo is offline  
Reply With Quote
Old 01-13-2010, 09:58 PM   #2
xenton
 
Join Date: May 2009
Reputation: 721
Posts: 2,412
Thank you sir, may I recommend this thread be stickied for the good of forum users?
xenton is offline   Reply With Quote
Old 01-13-2010, 10:09 PM   #3
capetaa21
 
Join Date: Sep 2009
Reputation: 24
Posts: 528
OMG probaly i will be in the first page for a LOOOOOOONG time ;D
Sticky NAW!! +rep & 5 stars
capetaa21 is offline   Reply With Quote
Old 01-13-2010, 10:16 PM   #4
meatstorm1
 
Join Date: Oct 2009
Reputation: 0
Posts: 88
Excelent, I just hope people will decide to give modeling a try. Not many allready know how to do it
meatstorm1 is offline   Reply With Quote
Old 01-13-2010, 10:21 PM   #5
nanosheep
 
 
 
Join Date: Jan 2008
Reputation: 3074
Posts: 12,419
Milkshape 3D? YOu missed it.
nanosheep is offline   Reply With Quote
Old 01-13-2010, 10:23 PM   #6
Mnemo
 
 
 
Join Date: Sep 2009
Reputation: 1151
Posts: 1,186
Quote:
Originally Posted by nanosheep View Post
Milkshape 3D? YOu missed it.
Added but is it really any good for making hats? I remember hearing that it's mostly used for really high-poly stuff. I might be wrong.
Mnemo is offline   Reply With Quote
Old 01-13-2010, 10:24 PM   #7
Chancellor
 
 
 
Join Date: Dec 2009
Reputation: 176
Posts: 1,757
I hope that valve won't make TOO many hats.
Chancellor is offline   Reply With Quote
Old 01-13-2010, 10:25 PM   #8
CapitalLetters
 
Banned
Join Date: Oct 2009
Reputation: 86
Posts: 786
Quote:
Originally Posted by meatstorm1 View Post
Not many allready know how to do it
Know why not many know how to do it? Because modeling/texturing isn't a simple pick-up-and-use thing. Hell, look at all the programs you need.

Anyone that's completely new to modeling and the like won't know the hell what you're talking about, especially since you "can't teach you how to do this or that", so you're pretty much leaving them in the dark.
CapitalLetters is offline   Reply With Quote
Old 01-13-2010, 10:26 PM   #9
nanosheep
 
 
 
Join Date: Jan 2008
Reputation: 3074
Posts: 12,419
Quote:
Originally Posted by Mnemo View Post
Added but is it really any good for making hats? I remember hearing that it's mostly used for really high-poly stuff. I might be wrong.
Its free (to a certain extent), and a small program. Not all computers are capable of running 3DS Max, but Milkshape is easier on older processors (I'm working on Pentium 4 1.6Ghz XP Desktops here, and the plastic has oxidised to a nice sheen of yellow).
nanosheep is offline   Reply With Quote
Old 01-13-2010, 10:36 PM   #10
vashts1985
 
Join Date: Jan 2007
Reputation: 1477
Posts: 2,298
repped for quality of instructional material. good to see people that want to help others learn the trade
vashts1985 is offline   Reply With Quote
Old 01-13-2010, 10:40 PM   #11
Mnemo
 
 
 
Join Date: Sep 2009
Reputation: 1151
Posts: 1,186
Quote:
Originally Posted by CapitalLetters View Post
Know why not many know how to do it? Because modeling/texturing isn't a simple pick-up-and-use thing. Hell, look at all the programs you need.

Anyone that's completely new to modeling and the like won't know the hell what you're talking about, especially since you "can't teach you how to do this or that", so you're pretty much leaving them in the dark.
I remember when I first started and it took me weeks just to get a model into source even though I collected all of these programs before I'd even began. The most aggravating thing wasn't that I didn't know how to model. In fact, learning that was the funnest part of the whole process. I was so enraged at how difficult it was to find a proper guide that told me what I needed to do next. Nobody who's just starting out wants to spend hours looking up what each command in a qc is supposed to mean.

People just want to be able to load up the game and see something that they created. There are plenty of other guides that can teach them the finer details of modeling. Also, if anyone has any questions, I'd be glad to try and help or at least point them someplace where they can find an answer. A thread doesn't end with the first post.

Last edited by Mnemo: 01-13-2010 at 10:45 PM.
Mnemo is offline   Reply With Quote
Old 01-13-2010, 10:46 PM   #12
Hippy Pacifist
 
Join Date: Dec 2009
Reputation: 334
Posts: 3,017
I just checked sourcrforge for free 3dmodelling programs.
http://sourceforge.net/softwaremap/t...p?form_cat=109

Not sure where to start.
Can I use FreeCAD to make something?


edit - nevermind, freecad doesn't like this.

Last edited by Hippy Pacifist: 01-16-2010 at 02:14 AM.
Hippy Pacifist is offline   Reply With Quote
Old 01-13-2010, 10:51 PM   #13
midifsta
 
Guest
Posts: n/a
nice. thank you kind sir.
  Reply With Quote
Old 01-13-2010, 10:51 PM   #14
CharmedPop
 
Guest
Posts: n/a
*Bookmark*

Thanks! This will be very helpful in the near future.
  Reply With Quote
Old 01-13-2010, 10:53 PM   #15
Mnemo
 
 
 
Join Date: Sep 2009
Reputation: 1151
Posts: 1,186
Quote:
Originally Posted by Hippy Pacifist View Post
I just checked sourcrforge for free 3dmodelling programs.
http://sourceforge.net/softwaremap/t...p?form_cat=109

Not sure where to start.
Can I use FreeCAD to make something?
I don't really know anything about it. It's probably be better to start with a more popular free program like blender since it's much easier to find tutorials for it. For instance, searching "blender tutorial" on YouTube brings up 9,310 results where as "freecad" only has 70.

Still, I really recommend 3DS Max. You can get a free trial after filling out a short survey: http://usa.autodesk.com/adsk/servlet...12&id=13571450

Last edited by Mnemo: 01-13-2010 at 10:57 PM.
Mnemo is offline   Reply With Quote
Reply

Go Back   Steam Users' Forums > Steam Game Discussions > T - Z > Team Fortress 2 > Community Content / Contribution Project > Other


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -7. The time now is 08:06 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.