[GUIDE] Blender, TF2 and You

Tapp

L10: Glamorous Member
Jan 26, 2009
776
215
Okay, TUT TIME
When I first exported an animated mesh, I was somewhat suprised that everybody feared it so much. Because of this inexplicable fear, I've decided to release this tutorial. This will cover the basics of your first animated model, and assumes nothing. If you already know something, just skip over it.

1.bmp


Here's the setup I generally use. It's mostly stock settings, with trackball, auto-perspective and the grid is divided into 8s.

We'll start by making a cube. Duplicate it (in edit mode, must be same object), then go back into object mode and add an armature. Edit it as shown, and name the bones so you know which is which. I find it's a good idea to turn x-ray on, since bones are usually hidden.

3.bmp


Select the cubes, then the armature, and hit ctrl+p. Select armature and name groups.

4.bmp

5.bmp


Go back to the cubes, and select the bottom one. Using the buttons in the lower left, assign it to bone1 (or whatever you named your bottom bone)

6.bmp


Do the same with the other

7.bmp


Enter pose mode and make sure everything's rigged correctly

8.bmp


Now switch to animation mode

9.bmp


Select the bottom bone and add a keyframe. This one will just be rotating.

10.bmp


Rotate it 90 degrees, move the time 15 frames and add another keyframe.

11.bmp


Do the same with the top bone, in the opposite direction. You need to use LocRot this time.

13.bmp

14.bmp


Switch to the action editor

15.bmp


Select all the keyframes and change the interpolation to linear

16.bmp


Simple UV texture, not important

17.bmp


Select the cubes, then the bones, then export as a static mesh and again as an animated mesh, then once more as a physics mesh.

18.bmp


We're done with blender for now. Open up your qc file, and add your sequence, below idle. You'll need to reuse the idle.smd file you've used before for static models.

21.bmp

22.bmp


Compile it...

23.bmp


And you're done!

24.bmp


Here's about what you should get, if you want to see my example.

Any questions or comments? And mick-a-nator, feel free to add this to the OP and/or resize/crop the pictures.
 
Last edited:
Feb 18, 2009
640
629
Any questions or comments? And mick-a-nator, feel free to add this to the OP and/or resize/crop the pictures.

I think I'll cut out the animation part, but thank you very much for showing everyone this. As I say, I deal in static props, so the process is somewhat alien to me. Can I ask though, is the physics model is different to the actual model, do you export is only as a physics mesh? btw everyone, when exporting a physics model, it doesn't have to be done with the physics export option. A regular static mesh (and presumably animated mesh as well) will work just fine.

@TrickyClock just checking, but are you using the entire armature? or is it just the bip_head bone left? If it is the former, then it needs to be the entire armature. If the former, sorry, just the way you walk of bip_head suggests it is the only bone :p
 

Urser

L1: Registered
Nov 6, 2009
14
1
Okay I'm also having some difficulties getting this working properly. I've finally compiled my hat and it works in game. However, the texture does not appear and the model itself is WAY off mark. The scaling is perfectly fine though, so I'm just wondering what went wrong.

So first problem - The texture is not appearing and I'm absolutely sure my .vmt and .vtf files are perfectly fine. Is there something I'm doing wrong in Blender? Is the skin for the UV mesh supposed to be in any particular directory when I'm exporting my model from Blender?

Second problem - The model isn't where it needs to be and is rotated awkwardly, yet I can't think of anyway to get it back into its correct position other than trial and error.

So what do you guys think? Would it be relatively easy to just get a trial of 3DSMax, import my model into it, and go about fixing everything from there?
 

Tapp

L10: Glamorous Member
Jan 26, 2009
776
215
I think I'll cut out the animation part, but thank you very much for showing everyone this. As I say, I deal in static props, so the process is somewhat alien to me. Can I ask though, is the physics model is different to the actual model, do you export is only as a physics mesh? btw everyone, when exporting a physics model, it doesn't have to be done with the physics export option. A regular static mesh (and presumably animated mesh as well) will work just fine.

I always assumed there was a difference between a collision mesh and a static mesh, but if you can, then I would recommend doing so. I can't get an animated physics mesh this way.
 

patrickcampbell

L1: Registered
Aug 30, 2009
5
0
I'm having this problem.
It happens after I scale it to 40, I'm a complete newcomer so please help. :)

jhfjsdhdfj.jpg
 
Feb 17, 2009
1,165
376
I can't seem to find a way to import the model. I got the scripts. I put them in the right place. So, help...
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
Mickanator:
Have you looked into the new 2.5.x Blender recently?
The new SMD import/export tools are looking very sexy!

No more scaling issues, no more bone-rolls and axis rotation issues for animation...
 
Feb 17, 2009
1,165
376
I figured out how to import the model. Now I want to know this: how can I scale the model?
 

ColonelBD

L1: Registered
Jan 9, 2010
18
21
Either scale it up by 40 in Blender, export, then undo. Or add to the qc file:
$scale "40" under the cdmaterials parametre. I personally prefer to do the former, but thats just me.
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
Does 5 months make this a necro post?

Just a mention that the 2.5x branch of Blender has now gone stable with the release of Blender 2.57.

Also the the Blender SMD Tools addon now supports the importing of DMX models, and can even compile QC files automatically. Best of all, no more mucking about with $scale when importing and exporting.
 

Tehrasha

L3: Member
Nov 5, 2009
115
28
I've been working on a new walk-through tutorial to replace the older 2.4x version on the Valve Dev. Wiki .

So far it is a very basic blow-by-blow key-press/mouse-click outline to give a specific result, and very much a WIP. If anyone would like to help flesh it out, and make it a better learning tool, let me know, and I will give it a proper page to live on, instead of sitting inside my user:talk section.

--> New WIP Walk-Through <--
 

Antonhel

L1: Registered
Apr 29, 2011
8
0
Help! For some reason, my model shows a checkered texture. I tried many ways to fix it, but nothing happens. Is there any way to fix this?

Here's my qc and vmt files:

Code:
$cdmaterials	"models/props_industrioid/asteroidpurple1/asteroidpurpletexture"
$modelname		"props_industrioid/asteroidpurple1.mdl"
$body "Body"	"asteroid1.smd"
$staticprop
$surfaceprop	"concrete"
$scale 40

$sequence idle	"asteroid1.smd" loop fps 15

$collisionmodel "asteroid1.smd" 
{
$mass 250.0
}

The vmt file

Code:
"VertexLitGeneric"
{
	"$baseTexture" "models\props_industrioid\asteroidpurple1\asteroidpurpletexture\asteroidpurple1"
	"$surfaceprop" "concrete"
	"$bumpmap"	"models\props_industrioid\asteroidpurple1\asteroidpurpletexture\asteroidbumpmap"
}