[GUIDE] Blender, TF2 and You

Feb 18, 2009
640
629
So you want to start modelling for TF2? You can't get your hands on a copy of 3ds max? You've tried Blender but it never seems to work? Then here are some important things you should know and learn.

STEP 1: Setting up
First, you'll need Blender of course! Go to Blender's website and download either version it presents (2.49 and 2.5x). It doesn't matter which you choose, but Blender 2.5 is very different to 2.4, and they each need different scripts and the one for 2.5 doesn't yet support animation. For this guide I have used Blender 2.48, but 2.49 should have a very similar interface.

STEP 2: Importing
If you want to edit a previously existing model, you'll need to decompile it and import it into blender (Skip to step 3 if not). I'm not going to explain decompiling, but this is a good tutorial for that.
Now that you have your SMD files, you are going to need to get an import plugin for Blender. There are a few about, but I use this one. It allows you to import all the texture information (including the UV layout) and generally I find it better and more reliable. WARING!!! it does however scale down the model by a factor of 40! This is extremely important as if you don't scale it back up, you will get tiny models when you export and compile. Another little annoying thing with this is that it imports an armature no matter what it is that you import. You need to delete it and everything that points to it otherwise you can't export it as a static prop.
armaturemodifier.jpg

armatureobjectsandlinks.jpg


One last thing to note on this script is that, where it does import bones, it can't import animation.

For Blender 2.5 users, use this. The only known problems are listed on the page.

STEP 3: Modelling
I'm not going to go over this. There are so many tutorials out there for you beginner modellers. To start you off, try Blender Noob to Pro.

STEP 4: Texturing
This should be in Blender Noob to Pro, but I'm just going to quickly run over it. After you have made your UV layout and textured it, you just need to link it to the mesh. Under "Links and Pipeline" in the Shading panel (F5) change MA:Material to the name of your texture with .vmt on the end for good measure (might not be necessary, but I do it to make sure).
materialsname.jpg

If you have multiple textures for one mesh, you have to go through this process. First, go into "Links and Materials" in "Editing" (F9) and click "new".
materialsaddnew.jpg

You should now see the box above say "2 Mat 2". Now you have to go back to "Links and Pipeline" and change the name of this texture. Back again to "Links and Materials" and select the faces you want to have this new texture and hit assign, making sure the box still says "2 Mat 2".
materialsassign.jpg

Select the other faces (ctrl+i inverts the selection) and hit the left arrow in the box to change it back to "2 Mat 1". Hit assign and you're done! If you have more than 2 textures, obviously repeat until everything has been assigned.

STEP 5: Exporting
When you're done, you'll need to export your beautiful model into SMD. Here you need another script. I use this one but I think there are others about. Just start the export script, select if the object is a static prop, the phys mesh, or an animated prop and tell it where to put it.
When exporting animated meshes, you will need to select BOTH the mesh and the armature. (more on this later, when I have more information)

Blender 2.5 users can use the same script I linked earlier to export your meshes.

STEP 6: Compiling
Remember that link I gave earlier for decompiling models? Go back to it, it will explain compiling models too!

Specific cases
This section will be kept up-to-date as situations arise which need to be covered.

Weapons and hats
I will go over this as if you have already created and textured a hat model. Begin by importing the model of that class for which your item is for (these can be found in your sourcesdk_content/tf/modelsrc folder) and scale by 40 as mentioned before, but preserve everything else, you'll need the armature. Now position, scale, and edit your model so that it fits and looks as desired. Next, remove the character model BUT NOT THE ARMATURE. Then you need to parent your model to the armature, and "skin" the model so that only the right bones are controlling the model. If you are creating a basic hat then you'll need to make the head bone (often called "bip_head") have 100% control over the model, and no other bones. I wont go over how to do these two steps, they're a common Blender techniques. Finally you just need to export the model with the armature as mentioned above.


And now you're done! Just load it up to check if it has worked then you can do what you like with it!
Enjoy your new skills and get creative!
 
Last edited:

JoshuaC

L420: High Member
Sep 2, 2008
444
164
From my experience you don't need to add .vtf to the end of the material name. .tga worked just fine for me.

I was hoping for a little more when I clicked on this thread, but it's a decent starter tutorial.
 
Feb 18, 2009
640
629
From my experience you don't need to add .vtf to the end of the material name. .tga worked just fine for me.

I was hoping for a little more when I clicked on this thread, but it's a decent starter tutorial.

That's what it was supposed to be, a way of telling people some of the quirks of Blender.

(I'll change that about vtf in the thread. On reflection it shouldn't need any file ending, but I'll check that)
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
I've made, and have been using a bunch of viewport and grid settings to make blender better match up with hammer. It means you don't need to worry about sizing things up to huge sizes.

Here's the preferences .blend.
http://dl.dropbox.com/u/49917/models/blender/.B.blend

That will come in very handy, Joshua!

Mick-a-nator, could you include a similar guide to exporting animated models?
There are so many options that can be set, it is very difficult to determine which ones are -required- and which are not.
 
Feb 18, 2009
640
629
Very nice Joshua. Very handy indeed.

Mick-a-nator, could you include a similar guide to exporting animated models?
There are so many options that can be set, it is very difficult to determine which ones are -required- and which are not.

I don't make (and therefore don't export) animated models much, but I'll have a look for you.
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
That would be great!

Dont kill yourself on something complicated like a ragdoll.
Just two bones would be sufficent. Im sure it only scales up from there. :)
 
Feb 18, 2009
640
629
much of the stuff to do with bones are done in the qc file I believe (such as jiggle bones and ragdoll) but the animation sequences are in the models (and therefore that's what you export).

EDIT: I've had a go at it, and I don't see your problem/confusion/whatever with exporting animated meshes.
Here's what I did:
Made an armature of 2 bones sitting in a cuboid (that had been subdivided a few time to make it actually bend).
Animated it.
Selected BOTH the mesh and the armature and just hit "Export -> Half-life 2 (.smd)... -> Animated Mesh" and it worked.
 
Last edited:

JoshuaC

L420: High Member
Sep 2, 2008
444
164
To export different animations, just select them in the action editor and then export them as an animated mesh with a different file name.

Also be sure you're using the "fixed" plugin, as it's the only thing that actually worked at exporting anything with an armature.
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
EDIT: I've had a go at it, and I don't see your problem/confusion/whatever with exporting animated meshes.

Here is the animated mesh that I am working with.

[nomedia="http://www.youtube.com/watch?v=1ExBDZEay2U"]YouTube- Blender -- Doomsday Machine V.5[/nomedia]

My confusion was which parts do I have to select when doing the export.
The mesh, the armature, the bones, the animation sequence iteself? Some or all of the above?

I -think- I know what to do now.
 

JoshuaC

L420: High Member
Sep 2, 2008
444
164
I've updated my blender settings file. I've updated some settings based on an odd observation. When exporting from blender and then importing to source, the bounds of the model are .5 units bigger than the actual mesh. I've updated my settings file to compensate for this little quirk. Now when you export something the model will be the correct size, but the bounds will be .5 units bigger.

http://dl.dropbox.com/u/49917/models/blender/.B.blend
 
Feb 18, 2009
640
629
With weapons and hats, it is advised that you import a reference model to work with. That will have all the position and rotation information already complete. To explain, lets use your axe as an example.

After you have created your weapon model, import the pyro's smd file (found in your sourcesdk_contetent/tf folder) and scale up by 40, as the OP describes. You can also/alternatively import an existing weapon model, but that will need to be decompiled first. Position, scale and edit your model so that it fits in the hand of the pyro, or so that it matches the location of the existing model and is at the desired size. Then you need to delete the imported pyro/weapon model BUT KEEP THE ARMATURE. Your model now needs to be parented to the armature (I wont go over this, its just a Blender technique). Now the bone controlling the hand needs to have complete control over your model (again, look this up if you need to). Then export the armature and the model and it should work.

Does that help? I'll update the OP with that information.