- Games, Toys, and Hobbies
How to make (.vtf) Animated Sprays for Source Games
Popular Source Games
Hello, today I'm gonna help you make or convert animations (moving pictures) to sprays that are usable by some of the games based on the Source engine. The games I know that support this are: Portal 2, Left 4 Dead (2), Half Life: Deathmatch and Counter-Strike: Source.
In this article I we will use a program called VTFEdit, you can download it here: http://nemesis.thewavelength.net/index.php?c=178
Once you have downloaded - and installed it, we can begin.
While reading this article, I will show my progress in the process of making my own animated spray. I will be making a dancing Rick Ashley!
This article assumes you already have an animation ready that you want to use as spray.
Make sure that you have...
- ...every frame (of your animation) as a separate image file.
- ...every frame as a square image. The width and height dimensions must be the same.
- ...every frame in the same directory.
- ...every frame's image file's name as the index of the frame within the animation.
It doesn't matter if your frame starts at index 0 or 1, hell, it can even start at 36. As long as the frames are in the correct numerical order. I haven't tested alphabetical order though.
I have prepared my frames with the steps above and this is my result:
as you can see, I have 13 frames for my animation.
With VTFEdit, we can load our animation, and then export it to our desired file format. (.vtf)
So lets import them into VTFEdit!
Open VTFEdit. When you are ready, go to the "File" menu and choose "Import". Select all the frames of your prepared animation and open them.
You will see the following panel:
You can see that there are 3 tabs, just stay at the "General" tab, we don't need the other tabs.
You can also see that everything is divided into 4 different groups: "General", "Resize", "Mipmaps" and "Normal Map".
If the checkbox "Generate Mipmaps" in group "Mipmaps" is checked, uncheck it. The same goes for "Generate Normal Map" in "Normal Map". Most of you probably don't know what those are for, but we don't need them anyway.
For the "General" group, set everything to how they are in the picture above, if not already.
Don't click on "OK" yet. We first need to know to what dimensions we want to re-size our animation to.
Sprays have to be equal in width and height, but their width and height will also have to be a power of 2. So for example: 1x1, 2x2, 4x4, 8x8, 16x16, 32x32, etc...
I want to re-size my frames to 128x128 pixels. You can choose another size though. Also keep in mind that sizes too big will make your spray unable to use in-game, but if you will have any problems with that, you will be helped a little later.
So if we take a look now at the "Resize" group, you have to make sure the "Resize" checkbox is checked. You can change the options below the "Resize" checkboxif you want, but only do that if you really know what they mean. If not, you can just let those options as they are.
Actually, we do want to change "Maximum Width" and "Maximum Height" to our desired dimensions. Note that we can only choose a set of numbers that is the power of two, as expected. So do that now, as you can see in the image above, I changed it to 128x128.
Ok, so now that we made sure all the options are right, click on "OK".
We've now imported our animation into VTFEdit. You can click on the "Play" button to see your animation play, it is very fast though. When you spray your animation on a wall in-game, it will play a lot slower. The only thing is, we can't set or change it's frame-rate. The least thing you can do is to delete some frames in between so that your animation appears faster.
Now that our animation is loaded and ready in VTFEdit, lets export it. Go the "File" menu again and choose "Save As...", you can then choose were to save the file as a '.vtf' file .
You animation is now exported to the .vtf format! But wait! We are not done yet!
Yes, we have to test it.
Import your spray in your game and spray it on the wall. If it works you should see your spray, if you see nothing then there is something wrong with it.
Sprays won't work if the dimensions (width and height) or the file size are too big.
I've researched for the maximum file sizes for .vtf files to be usable in-game, without success. I think that each game has it's own limits.
The file size limit will probably be around 200kB's for each game, some games less, and games more. The limits might get higher with some updates too.
The maximum width and height should be easier to find because it is more accurate when tested, but if you want to know you'll have to 'google' it your self: http://lmgtfy.com/?q=vtf+spray+max+size+for+game+x
You can also do it the trail/error way. That's what I usually do. Try to remove some frames or re-size it to smaller dimensions (but still square) until it works again.
But when you finally got it working, you may pat yourself on the back, you are ready.
Import your spray and enjoy spray spamming!!!