232 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
110 Comments
< >
☯ King Nether ☯ Mar 15 @ 9:29am 
If you are using Paint.net use the magic pen and cut the selection (which should be the background), then save it as a 32-bit TGA file. Then go to your pictures folder (under users and your name) then select the spray you just made.

I hope this helps.
[GER]Tranto Mar 15 @ 8:06am 
It doesn`t work for me...
If i impoert the files in the folder than they are not shown oin TF2 and if i just import the spray its shown in the options but not ingame
JotaPe679 Mar 2 @ 1:28pm 
Thanks, mate, the spray i made now looks surprisingly high quality in the game now.
Berk Feb 1 @ 1:42pm 
I couldn't install VTFEdit (mac user) but I tried my image anyway, without any of the VTF stuff, and my spray works fine as it is. Just thought I'd let you know. Thanks for the guide
Vampire Woona Jan 21 @ 4:23am 
hi.. i'm having an unusual problem. i successfully created several transparent sprays and even a moving, transparent spray some months ago and they were visibile in game and worked perfectly, but now several game updates later suddenly they no longer work. what happened?
Millsie Jan 17 @ 9:33pm 
Hey, I've followed the guide exactly and I've made my spray and placed it in the correct folders (both the .vtf and .vmt files) but when I join a server and place my spray, people can't see it, only I can. Can you help? Thanks.
Daft Jan 4 @ 6:43am 
Hi Jimo great guide! I ran into a problem that someone else ran into and I think you should add this to the guide. Every step was followed in this guide. The problem was in VTFEdit. The spray was not showing up as transparent even after selecting "Mask". It was also a solid white background when imported. Someone in the comments suggested that a new transparent layer should be created right below the spray layer. For some reason it worked and fixed the problem. After I re-saved this and imported it to VTFEdit, it worked. So I think you should add that to the guide, to add a transparent layer below the spray layer.
xG| The Unlit Torch Dec 18, 2014 @ 2:52am 
I figured out how to do it in PAINT.NET.
First, delete the background.
Then, save it as a png file.
Open it with VTFEdit.
Save the image as a .vtf file.
Open TF2.
Go into settings>multiplayer and click "import spray".
Select the .vtf file from wherever you saved it.
This was more complicated for me as I had to email it to myself a bunch of times because I play on a Mac, and VTFEdit is not available on Mac.
ILLtoni Dec 17, 2014 @ 4:31pm 
You can detail the ones you put for download(3 different ones)
still keeping this thumbed down
Jimo  [author] Dec 17, 2014 @ 3:49pm 
It's a guide for Photoshop. You can use other image editors but I am not going into detail for every single editor available on the market.