Team Fortress 2

Team Fortress 2

276 ratings
Creating Transparent Sprays
By Jimo
I will explain how to create a transparent spray for Team Fortress 2. This technique can also be applied to other Source games that allow sprays. For this guide you will require Adobe Photoshop, GIMP or PAINT.NET and VTFEdit.
 
Rate  
Favorite
Favorited
Unfavorite
Introduction
This guide will explain how to create a transparent spray for Team Fortress 2. This technique can also be applied to other Source games that allow sprays.

What You Will Need
Before we get started you are going to need a few tools so you can follow along with the guide.

You will need some form of image editor. In the guide I will be using Adobe Photoshop CS5 but other revisions of the program should work just fine. You can use GIMP or PAINT.NET as a free alternative to Photoshop as well.

Additionally you will need VTFEdit (Valve Texture File Editor) which is a tool used to convert your image in to the game world. I have provided links to all of the required software below.


Getting Started
Before we start making our spray we will need to find an image that we want to use. The end goal is to create a spray which has no background so it looks similar to graffiti when it's sprayed in-game.

The image will need to be re-sized to either 512 by 512, 256 by 256 or 128 by 128 pixels so keep that in mind when making your selection. Images which are either too wide or too tall typically will not work as well.

If you are an artist you can create your own design and follow the steps in the guide to get the same transparency effect.

For the tutorial I will be using an image I took of myself. Feel free to use it if you like!

Removing the Background
Open up your image editor and import the image you want to use on a new layer, separate to the background.

Select the Pen Tool.



Carefully draw around the parts you want to use in your spray. If you would like to learn more about how to use the Pen Tool properly, you can follow this nice tutorial by Melissa Evans here.[www.melissaevans.com]



Once you have finished with the pen tool you will need to locate the path menu. By default in Photoshop it should show up as a tab next to Layers and Channels. If you don't see it go to Windows > Paths.

When you have the Paths menu up you will see something called "Work Path". Simply right click on this and choose Make Selection.



Once you click on Make Selection a popup box will appear in the middle of your page. The default settings should suffice, so simply go ahead and click on Ok.



The parts that you want to appear in the spray should now be selected.



Right click on the selected area and choose Select Inverse. This should now make the area outside of the cut out selected. All you need to do now is simply hit Delete on your keyboard and you should end up with something like this.



If the background doesn't delete and a popup window comes up instead, it is more then likely because you didn't create a new layer for your image.

You are now ready to proceed to the next step!
Resizing the Spray
If you are like me and find doing detailed cut outs of larger images easier, you will now need to resize your spray. You are able to use the following sizes in TF2:

  • 512 by 512 pixels
  • 256 by 256 pixels
  • 128 by 128 pixels

If it's already one of those sizes, you can skip ahead. If not, keep reading.

For this guide I will be using 256 by 256. Open up a new 256 by 256 pixel image and set the mode to transparent.



Open up the large cut out version and drag and drop the layer on to smaller image you just created. I've highlighted the tools you will need to use to do this below.



You should now have a very large image in your small canvas. Click on the Move Tool and make sure you have Show Transform Controls checked at the top. Once this is turned on you will see some areas around the image that you can use to resize it. Grab one of the corners and hold down Shift on your keyboard. This will keep the image constrained perfectly so it's impossible to make it look squished or deformed.



You should now have something that looks a bit like this.



At this point you can make any changes to your spray to fill up the white space. I decided to add my name to the bottom of it, so it doesn't look like a hand is coming out of no where. I created this on a separate layer from everything else. I also adjusted the brightness and contrast of the Sandwich so it reads better in the game.



When I was done making any changes I merged the layers together to make the next steps easier. You can do this by shift clicking on all of your layers and right clicking and choosing Merge Layers within the Layers panel.

You should end up with something looking like this. Your spray should be on it's own single layer and you should have a background layer with nothing in it.




Defining the Transparent Spaces
Source games do not read PNG or GIF image transparency, It has to be done through Alpha Channels.

With your spray open, hold down control and click on the spray in the layer panel, I've highlighted the areas you need to click below, and what it should look like after you've clicked on it.



Next you want to click on the Channels tab, by default this will be next to Layers. If you somehow closed it you can reopen it by going to Windows > Channels.

With the Channels tab open and your foreground image selected, we will need to click on the Create New Channel button at the bottom. I've highlighted this selection below.



You will now notice that your image has gone entirely black. this is normal and just means you're doing everything correctly. When you apply alpha channels different colours mean different things.

  • White - Entirely Visible
  • Black - Invisible, these areas will not show
  • Gray - Semi-Transparent

For this tutorial I will simply be using White. Using some grey where you have drops shadows is typically a good idea, but isn't entirely necessary.

Select the paint bucket tool and choose a pure white colour, the HEX number you will be using is #FFFFF.

Paint in the selected area. You will now end up with a white blob kind of like what I have below.



Make all of your channels visible again. This is exactly the same as hiding a layer, simply click on the eye left to the left. All of them need to be set to visible, including the one you just created.



The red area is now the transparent part. If you are unhappy with how it came out you can readjust the Alpha Channels by going back or loading a previous save.

Mine isn't perfect by any means.



All that is left to do now is Save the image. Navigate to File > Save As... and save it as a Targa File (.TGA). You will need to make sure you have the Enable Alpha Channels option selected.



Creating the VTF with VTFEdit
We're almost there, and all that is left to do now is convert the TGA image in VTFEdit to a VTF. If you don't have VTFEdit yet, you can download it for free here[nemesis.thewavelength.net]. For those wondering, VTF stands for Valve Texture File.

Open up VTFEdit and select File > Import and navigate to your spray.

You will get a VTF Options panel popup. From a fresh install the only thing you need to change is the clamp, and it needs to be set to 256 by 256. I've posted a screenshot of the settings I used below.



You will need to change a few options once you have the spray imported. First of all you will notice that the spray is now on a white background, which obviously isn't transparent. Go to View > Masks and you will notice that it now looks similar to a transparent image in Photoshop again.

You will also want to make sure you have No Mipmap and No Level Of Detail checked under Flags on the left hand side. This will make your sprays high quality in the game, no matter who is viewing them.



All you need to do now is File > Save As.

You will also want to do Tools > Create VMT. Simply choose the defaults when you get the options window for this, and select Create. VMT stands for Valve Material File.

Importing Into TF2
You have now finished creating your spray, and the only thing left to do is try it out. All you need to do is paste your VTF and VMT file in to your TF2 directory. For most people this is located here:

VTF: C:/Program Files/Steam/steamapps/common/team fortress 2/tf/materials/VGUI/logos
VMT: [/b]C:/Program Files/Steam/steamapps/common/team fortress 2/tf/materials/VGUI/logos/UI

If you are missing any of those folders, simply create them.

Once you have everything in the correct directory, load up TF2 and go to Options > Multiplayer. Underneath the Spraypaint Image tab you should now see your brand new spray.

If it's not on the drop down menu you will need to choose Import Spray and navigate to it within the Steam directory.



Apply your changes and join a server, you're done! Keep in mind that some servers disable sprays as part of their config.


Closing Notes
If you have any questions or comments regarding this guide please feel free to leave a comment below or get in touch with me on Steam or through my website[www.Jimo.co.uk].

You can also check out all of my other Steam Guides here.


http://steamcommunity.com/sharedfiles/filedetails/?id=121269706
http://steamcommunity.com/sharedfiles/filedetails/?id=121356624
< >
131 Comments
MindlessGonzo Jan 14 @ 5:18pm 
Instructions followed. Spray shows up white where it's supposed to be transparent. The fix was making sure your Alpha Format under General options in VTFEdit is DXT5.
TheRedChameleon Dec 31, 2015 @ 1:05pm 
Worked for me
MUTANT OVERLORD Dec 26, 2015 @ 10:59pm 
@[DFS] Dragon Dreemur
thats cool
Dragon Dreemurr Dec 26, 2015 @ 4:55pm 
I got the picture, but when i tried to apply it to the game, i had a entirerly invisible spray.
MUTANT OVERLORD Dec 18, 2015 @ 9:05am 
Thanks mate, worked fine with PAINT.NET.
Well, time to spam transparent sprays BUAHAHA
KittyGamer Dec 13, 2015 @ 2:42am 
in photoshop
I kept having trouble with this guide because my photoshop didn't select the right option and the guide didn't specify the right option when you are saving the TGA
photoshop gave me the option of
-"16 bits/pixel"
-"24 bits/pixel"
-"32 bits/pixel"
and the only one that seems to work is "32 bits/pixel"
and again uncheck "compress RLE"
KittyGamer Dec 13, 2015 @ 2:37am 
in paint.net
open image
remove areas that are meant for transparency
go into "save as" - or ctrl shift s
select "tga" in "save as type"
choose where you want to save it and click "save"
in the options that pop up
always choose "32 bit" and for me it works if you uncheck "compress RLE"
how I check if it saved correctly is I go to the folder in explorer and hover over the image and it
displays "Pixel Format: A8R8G8B8"
although I don't know if that tool tip info is available on all versions of windows I'm using win10
and then from there it's identical to the guide above
Sans Dec 9, 2015 @ 3:00pm 
Cool. Now make one for Paint.net, so the rest of us can do this.
Strmbrkr Nov 21, 2015 @ 1:12pm 
Omg thank you for this!
[DFS] Dolorosa Maryam Nov 20, 2015 @ 4:19pm 
HAHAHAHAHA doesn't work for fucking shit man