Source Filmmaker Guide

Layman's Guide: TF2 Mod to SFM for Source Filmmaker

Layman’s Guide: TF2 Mod to SFM

Overview

A simple, step-by-step guide for bringing modded TF2 items to SFM. Whether from Gmod, or Mod.tf, this guide will give an understanding of the conversion process. This guide takes pieces of information found in other sources, in order to create a “one stop shop” for those new.

A Layman’s Introduction

Howdy…

You ever look at a TF2 mod on a random site, or a hex on Gmod, and think to yourself “man, I’d like to put that on one of my characters for this animation!” Yet how to do so evades you at every turn? No matter what keywords you put into the search, it comes up with everything you’re not looking for? I’ve felt that pain, and am willing to guide you out of this void of mind numbing torture called “research.”

Disclaimer

Most of what I’m going to tell you, I’ve learned over a short time. I’ve focused my attention to other softwares for animation and modeling. Thus, there are things I still do not understand, and would greatly appreciate the input if there are solutions I’ve not found.

Required Programs

There are a few select programs required in order to continue through this walkthrough. A breif description, and download links bellow.

GCF Scape:

– Used to explore different file types as if it was a zip folder, kind of like Winrar or 7Zip but specialized.
Only working download I could find[web.archive.org]

GIMP:

– It’s an open source photo manipulation program, useless on it own, but paired with the following plug-in, will come in real handy.
Download[www.gimp.org]

GIMP’s VTF Plug-in:

– A plug-in for GIMP, that allows it to open Valve’s Texture File(VTF)s. This is important to have in order to fix texture problems that will occur with paintable items.
Download[code.google.com]
-To mount the plug-in so GIMP can use it, place all the files in the C: Drive path “Users/<user>/GIMP <version>/Plug-ins.”

There are more items that can be used in this process, but these are the essentials.

Downloading and Extracting the Files

For Mod.tf

For this walkthrough, I’ll be converting a number of items from Mod.tf. The one we’ll be following through most of it, is the Egghead.

Once you download the files of your choice, launch GCF Scape and open your downloaded file. You should see a “materials” and “models” folder in the large display. Drag and drop both folders into a file of your choice, here I decided to keep things clean and have an extraction folder.

Before continuing, within the “materials” folder, there’s another folder named “backpack.” This is useless for us, and is better off being deleted.

For Gmod

Inside of the “/steamapps/common” files for Garry’s Mod, there’s an executable in the bin called “Gmad.” This functions as an exporter for addons you have downloaded and mounted to Garry’s Mod (when you first launch Garry’s Mod with the addon installed). You’ll locate your mounted workshop items in “/steamapps/common/garrysMod/garrysMod/addons.” From there, you can drag and drop any addon file onto the “Gmad” executable, and it will decompile it.

Reorganizing and Renaming Files/Folders

For Both

Once all the files are extracted, the file paths for the “material” and “model” folders will most likely look like this.

This pathway will not work in SFM due to one thing. SFM uses mirrored pathways, meaning the “material” and “model” folder paths look identical bar the “material” folder being one step behind.

The way to fix this is by adding and subtracting folders to the “models” path until it looks like the “materials” path. It will look like this by the end.

With that done, the models and textures should be at the end of those paths. The only problem left for this stage, is that the model names aren’t the same as the materials.

The Materials

The Models

What we must do is copy the name of the basic material, and replace the model’s name without getting rid of the extensions. It should look like this when you’re finished.

Bringing the Files to SFM and Fixing Textures

For Both

Follow standard implementation after this, “materials” and “models” go to their respective content folders found in “steamapps/common/SourceFilmmaker/<game or content>/<foldername>”. Once finished start SFM to see if the model has been implemented correctly. It shouldn’t have any black patches, or be invisible.

Gmod Problems

When porting Gmod TF2 hexes, there’s a chance that the model will be transparent. This means that the texture paths are incorrect, yet even after all the correct steps are taken it happens. My assumption is that it’s due to how it was hexed. I don’t know how to fix this.

Texture Fixing

In the event that you port a file that has paintable pieces. There is a high likelyhood of the paintable area being black, and unpaintable. Like so.

This is because the alpha channel of the VTF textures function differently in SFM, as opposed to TF2 or Garry’s Mod. To fix this, we will import the texture into GIMP using the VTF plug-in. It will look something similar to this.

Our first task is to copy the alpha channel mask onto the texture. To accomplish this we’ll right click the layer on our right, and check the three items named disable layer mask, edit layer mask, and show layer mask. The Image will change to a black and white image, Copy the mask. From here, we’re going to select the black of the mask, invert the selection using ctrl+i, and fill the inverted selection white. This makes it so the color applies evenly to the designated items. If the black isn’t cleanly selected by the color selector, paste the mask, and set the mode to overlay. Mode select is just above the opacity slider. Right click the floating layer, and choose anchor layer. This intensifies the lighter parts of the mask. Do this until you can cleanly select the black portion of the mask with the select by color tool. Your mask will probably look like this.

What we’re going to do now is right click the layer again, and uncheck the items named edit layer mask, and show layer mask. We have to do this, or our next step will be applied to the mask. Paste the copied mask. In order to only lighten to the paintable areas, select the floating mask, and set the mode to screen. By this point, your picture should look similar to this.

The final things to do in GIMP is to right click the floating layer, and select anchor layer. This applies the floating layer to the texture. Right click the texture, and uncheck disable layer mask. When the image looks like this, you’re ready to export.

Exporting Textures

Exporting

Now that we’ve fixed the textures, we can implement them back into SFM. Left click File, choose export, and choose the VTF texture you were modifying. It will ask if you wish to replace the texture, choose yes. several format options will open up, uncheck #withcompressionlabel, and mipmaplabel. Like so.

Relaunch SFM, and test to see if your textures are fixed.

Conclusion

With that, you’ve successfully ported a TF2 mod into SFM. There are still some things to fine tune once you get the hang of this, but this is the bread and butter of it.

Sources

The Freakin’ Scout’s a Spy. “Guide :: Hexing 101.” Steam Community, Valve, 16 May 2017, 1:11am, steamcommunity.com/sharedfiles/filedetails/?id=922631904.

Demi. “SFM Tutorial: Fixing Textures.” Youtube, 11 April 2017, .

SteamSolo.com