How to make (.vtf) Animated Sprays for Source Games

Popular Source Games

Introduction

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=178Once 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!

Preparation

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!

Import Animation

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.

Export Animation

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.

Testing

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.

This website uses cookies

As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

This is used to display charts and graphs on articles and the author center. (Privacy Policy)

Google AdSense Host API

This service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)

This is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)

Facebook Login

You can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)

Maven

This supports the Maven widget and search functionality. (Privacy Policy)

We may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.

Conversion Tracking Pixels

We may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.

Statistics

Author Google Analytics

This is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)

Comscore

ComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)

Amazon Tracking Pixel

Some articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)