Image


Blender to SFM | Valve Biped Names | Custom Blender Nodes


Porting from Blender to Source Film Maker

So you’ve made an amazing model in blender, now you want to use it in SFM. Very quickly you may have realised that it isn’t as straight forward as pressing “export” and then just loading it up in SFM.

In this guide I aim to show you how to get your model from Blender to Source!

If you are having issues at any point in time, you can download my CanMan.blend and SMDs+QC here.

To begin, you are going to need a few tools:

Quick note: high poly count models are going to be hard to port!

Setting up the folders

Create a new folder somewhere, doesn’t matter where or what it’s called (call it “blendersfm” if you like) and then make another folder inside that called “export”.

Drop both your model and all relevant textures inside the “blendersfm” folder. I have my CanMan Blender file and Texture.png in mine

Texture.png

Save the Blender Source Tools zip file into your “blendersfm” folder for easy access

Creating a Source compatible model

For this demo I’ll be making a man made out of cans. Here you can see I have created a cylinder

Image


Go to the show options menu for this cylinder and select “Open” under “Image”

Image


Select the texture for your model, in this case it’s “Texture.png”

Image


This is what you should now see in the materials tab

Image


Select the other texture option (uses the “materials” icon) in the texture tab and ensure that the loaded “Texture” is set as the default

Image


Head over to the materials tab and rename the default material for your object to the same as the texture we were using before (not case sensitive but I would still recommend you keep your capitalisations constant throughout everything)

Image


In the UV/Image Editor window open up the file we loaded before (“Texture.png” in this case)

Image


In edit mode in the 3D viewer, you'll want to use CTRL+E to mark seams around the top and bottom faces and on one of the vertical lines (as shown)

Image


Then select all verts (A) and press U->Unwrap

Image


You should now see you mesh unwrapped over the texture sheet we opened

Image


Re adjust as needed

Image


In “Material” or “Texture” mode your model should now have a texture!

Image


I duplicated the can with SHIFT+D a few times to make a person shape (in “Object” mode)

Image


I then added an armature to him, if you already have an armature then you need to make sure you are using the correct names for the bones, check the names here

Image


Make sure you have “X-Ray” and “X-Axis Mirror” turned on

Image Image


When the arms are first extruded they will not mirror, this is fine.

Image


You can rename the bones by clicking on them and going to this menu

Image


At this point you may want to start using the correct names, do note however that the ValveBiped names wont allow the mirror function to work properly!

Image


To get around this issue, you can name them as shown and rename them to the correct names once the rig is finished.

Image


Same goes for the legs

Image


Finished rig

Image


Now you need to parent the objects (cans) to their corresponding bones! Select a can, then SHIFT select a bone (rig must be in “Pose” mode before you can do this)

Image


Pressing CTRL+P will bring up the parenting menu, make sure to select “Bone” (this will work for most FNaF models where the model isn’t a single mesh)

Image


Make sure to deselect the bones as you go! (See how “Head” is still selected)

Image


Once you have finished that, all the objects should be children of the armature

Image


Now would be a good time to rename all the objects (I forgot to rename Cube to Pelvis here, doesn’t really matter what you call it)

Image


Exporting from Blender

Select all of the bones of the armature while it is in “Pose” mode

Image


Press I (Insert Keyframe) and select LocRotScale (Location, Rotation, Scale). This should add a keyframe to your model (necessary for exporting)

Image


Now you are going to want to install the Blender to Source exporter plug in. Go to File->User Preferences

Image


Go to the “Add-ons” tab and click “Install from File”

Image

Image


Open the Blender Source Tools zip that you downloaded before

Image


Searching for “Source” in the “Add-ons” tab should now bring up “Import-Export: Blender Source Tools”

Image


Select the tick box next to it (may take a while to load, bare with it)

Image


Save and close the preferences

Image


You should now be able to see the “Source Engine Export” and “Source Engine Exportables” property menus under the “Scene” properties tab

Image


Select the “SMD” option

Image


Change the “Export Path” to the “Export” folder we made earlier

Image

Image

Image


Leave “Engine Path” blank

Image


Your properties should now look something like this. Change the “Subfolder” property to “anims” (not sure if this is required, as I don’t remember actually doing it, but the anims folder will be important later)

Image


Now hit “Export” and choose “Scene export (n files)”

Image


If you were successful you should see this little box show up in the top bar of Blender, if not it will tell you what went wrong

Image


Your “Export” folder should now look like this (note the anims folder!)

Image


Source Model Files

NOTE: USE NOTEPAD++, NOT WINDOWS NOTEPAD. ALSO; WINDOWS SHOULD NOT RECOGNISE THIS FILE AS A “Text Document”, IF IT DOES THEN YOU HAVEN’T RENAMED IT CORRECTLY. IT SHOULD APPEAR AS A “QC File”

Now you need to make a new file called “My-Models-Name.qc” (make a new .txt file and rename it)

Image


Then you need to edit this file, adding the following:

Image

$modelname “” defines the location the model will be saved in and the name of the model. eg: $modelname “yourname\My-Models-Name.mdl” (same name used for the QC file!)

$body defines all the parts of the model, like the arms and legs etc. The names you give them don’t have to follow any rules, but make sure it is human readable with no spaces. the file in “quotations.smd” is the file name of the file in you “Export” folder

Note: these can become quite large for models with a large number of objects

Image


If you want certain parts of the model to be optional, then consider using this method (the user has the option between either “Toy Bonnie Flying V.smd” or “blank”)

Image


The next thing that you NEED is $sequence “” “” {}

The first name (“animation”) is the name of the animation, the second (“anims\ArmatureAction.smd”) is the location of the animation file, finally the fps is required in the curly braces.

Image


Final thing you need is the materials location, $cdmaterials “”

The root directory for this changes per game, however in SFM it is in “Usermod/materials”, so don’t worry about including that directory!

You can rename “CanMan” here to anything you want, your name or the models name, doesn’t matter

Image


Source Textures

In VTFEdit you need to go to Tools->Create VMT File

Image


This window should appear, fill it out as shown (“Base Texture 1: models/CanMan/texture” and “VertexlitGeneric”)

If your model uses more that one texture sheet, you are going to need a different VMT for each (change “models/yourmodel/texturename” as required)

The texture location will ALWAYS be “models/somefolders/texturename”. DO NOT MAKE IT ANYTHING ELSE!

NOTE: The texture files referenced here don’t actually exist yet! You must type in the file name manually, do NOT browse for them!

Image

Image

Image


Save this in the “Export” folder with the same name as the texture sheet (eg lol.vmt for lol.png or lmao.vmt for lmao.bmp)

Image


If you attempt to open the file you just made it should look like this!

Image


Your “Export” folder should now look like this. Now you need to “Import” (NOT “Open”) the “Texture.png” into VTFEdit (File->Import)

Image


Then just hit “Save As” (File->Save As) and save it as “Texture.vtf”

Image

Image


You should now have these three texture files. You can go ahead and remove your “Texture.png” files from “Export” if you wish (if you moved them into there), we only need the vmt and vtf

Image


Compiling for Source

Open up Crowbar and locate your QC file in the “Compile” tab

Image


Set your settings like this (check “Output Folder” and set “Subfolder” to “compiled”, select “Source Filmmaker” for “Game that has the model compiler”)

Image


Hit compile and if you have done everything right, you should see no errors and get this message!

Image


Below the message box you should see this, click on “Use in View”

Image


This opens up the “View” tab with the model you just compiled. Hit “View” and see what happens

Image


Uh-oh! Don’t worry, this is just because we need to move the model into the SFM source files

Image


Copy the files from the “compiled” folder to the usermod\models\yourname folder and the texture files to usermod\materials\models\thenameyoudefinedintheQC

Image

Image

Image


Open up Crowbar again and change the “MDL File” to the one you just put in the SFM files (eg “canman.mdl”). Hit “View” and see what happens this time

Image


TADA! You model is now ready to be used in SFM! (It’s even in the right location, all you gotta do is just fire up SFM!)

Image


Lucas "LAK132" Kleiss | Twitter | ko-fi | Patreon