Team Fortress 2
661 ψήφοι
Creating Transparent Sprays
Από 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.
2
7
   
Βραβείο
Αγαπημένο
Αγαπημένο
Μη αγαπημένο
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.


228 σχόλια
Fizzarolli 23 Φεβ, 20:57 
Will this work in all Source games or just TF2 specifically?
SLAWORAD 21 Φεβ, 14:00 
Yo i dont know how to respond to other comment but Darlight bro thank you. It was the 32 bit problem. Thanks
10 Φεβ, 18:32 
2024 and this guide is STILL helping me make beautiful gay furry pron sprays for L4D2, transparent around the subject, and sometimes even some shadows in the art are left in and made semi-transparent, thanks to this guide!!

:3

most recent spray I got for L4D2 using this guide is Stitch from leo and stitch. But stitch is putting his booteh up. and nude uwu
cavespider2009 4 Φεβ, 2:01 
soooo what to do if the image isnt in the file selection on the import spray menu?
skelebratz 12 Ιαν, 20:22 
I'm having a similar issue to the below commenter-- After I have correctly relocated the .vtf and .vmt files and selected them in the in-game file directory, they do not appear to load despite the fact I have followed this tutorial (using paint.net and whatever adaptations came with it) to (almost) a tee. Any help would be very much appreciated
Sogeking 12 Ιαν, 14:43 
It's not in the dropdown and when I try using import the spray doesn't get selected
</MiloshDaDogeDev> 4 Ιουλ 2023, 7:43 
does photopea work
Jazzratoon 31 Μαϊ 2023, 0:59 
Thanks for the guide!
Ronkhus 4 Φεβ 2023, 13:20 
This doesn't seem to work for me; It just shows up as a missing texture ingame, do you know the fix for this?
Toony17xd 22 Νοε 2022, 12:02 
THANKS!!! at first it worked but after a while it stopped working and I don't know why. thank you very much indeed.