182 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: 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
83 Comments
< >
iLembus Jul 8 @ 10:09am 
without Alpha Channel the transparent is yellow
with alpha channel its white idk
Jul 6 @ 1:07pm 
It can only open VTF files..
Gimp can only make TGA files.
What a fail
[TF2 SVS] Sandvich Slut Jun 17 @ 12:05pm 
can i get someone to do this for me?
pls?
Sgt. Paincakes Jun 13 @ 5:57pm 
I'm making an animated transparent spray, and for some reason I can see the spray when I import it into TF2, but when I spray it on a server, I can't see it. Any ideas?
Zerged Jun 12 @ 9:58am 
thanks for making this guide
Sir Kenny the Stupid Jun 11 @ 12:27am 
I made it up until the last part. When going into TF2 and clicking on Import Spray, the VMT file does not show up. Both the VTF and VMT files are in the correct folders so I'm not too sure where my misstep was. Any advice would be deeply appreciated.
TheMysterȋouƨ™ Jun 5 @ 12:16pm 
nvm, reason why it didnt work was because it had the same name as my other spray
TheMysterȋouƨ™ Jun 5 @ 11:35am 
It went well untill the import in tf2 part, in the Options in tf2 it shows up a black image, and when I try spraying in-game it uses my old spray...?
eXtory Apr 2 @ 8:05pm 
Thanks pal.
Toonces the Driving Cat Mar 22 @ 5:31am 
Thanks for all this! Even though I've made quite a few of my own transparent sprays, I'm always forgetting how to do it. It's nice to have this tutorial right at my fingertips whenever I need it!