How To: Model for Source in Blender

I’m making a SourceMod with a buncha friends, and we needed a couple models. Now I don’t know about you, but I don’t have $3,000 lying around for 3DS Max and I don’t intend on pirating it–so naturally, Blender is the best choice here. Free and relatively simple to use once you get past the UI. That’s not what this is about, though. If you want to learn about how to use Blender as a beginner, this tutorial should nudge you in the right direction. I may do some “beginners” video tutorials of my own similar to the one below in the future if there is a need.

Since originally writing this tutorial, I’ve made my own Blender script to export to SMD files as the other ones out there either don’t work at all or don’t export UVs properly. Mine fixes all of that, and I’ve made a video tutorial to go along with it. Enjoy.

Download Plugin
Use this script for animations (And the top one if you’re having root bone trouble)

idle.smd


version 1
nodes
0 "joint0" -1
end
skeleton
time 0
0 0.000000 0.000000 0.000000 0 0.000000 0.000000
end

material.vmt


"VertexLitGeneric"
{
	"$basetexture" "models/props/<materialname>"
	"$surfaceprop" "metal"
	"$model" 1
}

model.qc


$modelname		"props/<modelname>.mdl"
$body mybody	"<modelname>.smd"
$staticprop
$surfaceprop	"metal"
$cdmaterials	"models/props"
$scale			1

$sequence idle	"idle.smd" loop fps 1

$collisionmodel	"<modelname>-phy.smd" { 
	$automass
	$concave
}

$keyvalues
{
   "prop_data"
   {
       "base"  "Metal.Medium"
   }
}

run_studiomdl.bat


@"c:\program files\steam\steamapps\<username>\sourcesdk\bin\ep1\bin\studiomdl.exe" -game "c:\program files\steam\steamapps\<username>\garrysmod\garrysmod" <model>.qc
pause

To spawn your model in the console:


sv_cheats 1
prop_physics_create props/<model>.mdl

Anyway, hope you found this somewhat useful. Have fun modeling, and have fun doing it all for free!

To use animations:
Simply make your animation just as you normally would with the Action Editor.
Select the animation you want to export in there, and do a File > Export > SMD > Animation and you’re done.
Just use the $sequence command in your QC file to tell Source what your animation is.

VTA Exporting
Here’s a modified script by windwakr that supports VTA exporting.

Major credit to Pluss Roland for the original SMD exporter script.

Well played, sir.

Very nice, I like it.

Many thanks! But what is a good poly count to have as a maximum?

I’ve made my own Blender script that exports UVs properly, as none of the ones on the VDC wiki work properly. I’ve also remade this tutorial as a video, as well as added a lot of new content and posted my script in the OP.
Enjoy!

Honestly I’ve never really met any limits or had any models so high-poly that they lag. Just try to make your models as low-poly as you possibly can without compromising quality, and you should be fine.

It looks good, thank you for this, it really helped me!

When i try to export mine says “there is no mesh selected with an attached armature” could you help please?

I have gotten my models in-game perfectly, without textures that is. I just seem to have a disability to be able to get textures on them.

And chill_dude, what version of Blender are you using?

the newest i think i dont know how to check it!

But im using python script 2.5.2

Wow, this is Awesome! Thanks a lot, friend.

Add an armature in your blender scene. Next, select your model then the armature (using Shift), and hit CTRL + P to parent the armature to the model. Select armature and Don’t Create Vertex Groups. Then select the model and export!

You don’t need an armature, well at least I don’t. You need to make sure to UV Map it properly though, I am expecting you have done that…

How do I add hands to my weapon models? Can I do this in Blender? I would really like to be able to make weapon models as well but have no idea how to add the hands in. Do I need to make my own? Is there some sort of pre-made type…?

Cool!

You don’t need armature for my plugin–if you don’t have it, it’ll automatically add one for you to the export.
You also shouldn’t have to UV either, unless I’ve mucked up some code somewhere.

As for the hands, my guess is that you can just make your own or mod the CSS ones. I really wish there was some easy way.

I can get the CSS ones? How/where can I get that? They are pretty much perfect for what I need!

-snip-

Damnit these forum changes are really pissing me off, every post I make is a double one! :confused:

I think zbrush is better then blender in my opinion.

You’re comparing helicopters to volcanoes here, armopride. Blender is a general multi-purpose app, as Zbrush is pretty much just for modeling. You can’t animate in Zbrush, and you also can’t export to SMD.

I am getting some errors when trying to export the model into .smd.

Plus the ignoring factor is strange because the old script I used to use did not have that.