Go Back   nV News Forums > Software Forums > Gaming Central

Newegg Daily Deals

Reply
 
Thread Tools
Old 09-27-05, 01:46 AM   #1
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default A better way to create animated CS:S sprays

A while back I went around the net looking for some guides for making animated CS sprays, and I found some that helped but I noticed that the majority of them instruct you to do some things that are both tedious and very unnecessary, and other things that are downright counterproductive and shouldn't be said (e.g. many of them suggest using lossy jpeg image formats for interim saving - ick.) So with that said, I got bored today and decided to write my own "advanced" mini howto instead. Advanced in that I have some additional tips for some things that I found on my own, and I don't believe have been mentioned elsewhere yet.

If you've been through one of these howto's before and think you know all there is to know about creating animated sprays for CS:S, you may still want to read through this anyways as I myself have done things with these sprays that I haven't seen anybody else yet do. For example, using my method I can *easily* fit 11 frames in 128x128 sprays whereas other guides claim that the max limit is 5 frames.

For this howto I am going to walk through two programs: adobe imageready, and nem's VTFEdit - downloadable here. Don't bother with vtex from valves SDK as other guides suggest - it's a bit convoluted and it only supports one image format: TGA. VTFEdit supports a wide range of formats though, and most importantly, it supports PNG. (Note: vtfedit requires the .net framework to be installed unfortunately.)

On that note, I recommend using PNG and nothing else for this purpose as it is completely lossless unlike gif (partially lossy as it only supports 8-bit graphics) and jpeg (very lossy, highly not recommended for this purpose at all,) PNG is supported by pretty much everything, and PNG files are typically much smaller than BMP files.

Also note that imageready isn't always required for this (unless you start with an animated .gif file, then you need it) but I prefer to use it for its crop features and higher range of filters. Also another thing, you can skip a lot of what I say if you aren't picky about image quality (I for one am very picky.) I've denoted those parts of this howto with grey text. Anyways, lets get on with it..

1. Find or create an animated image, and open it with imageready.

Note that you don't have to start with e.g. an animated .gif or .mng file, you can also start with a series of .bmp .png, etc files (makes it easy if you are creating your spray from scratch.) If you start with a series of image files, you can open them in imageready as follows:

file > import > folder as frames...

Then select the directory that contains each frame of your animation. Make sure that the files for the animation are named sequentially (e.g. image001.bmp, image002.bmp, image003.bmp, etc) otherwise your animation will be out of order.

If you have an animated gif...well, just use file > open

2. Resize the animated image to fit the constraints of what source will accept for valid multiplayer sprays.

Before you actually resize it, I would crop it to make sure that it has a 1:1 dimensional ratio, otherwise it'll look skewed in the game (this should go without saying anyways, but I've seen too many people screw this up.) Say for example if you obtained your animated logo from a 720x480 DVD video, I would crop all of the frames to be 480x480 first (fortunately imageready makes this an easy onestep process for multi-frame images.)

Once you have that done, you'll want to resize your image to something that will fit within the constraints of what the source engine will allow. The most important limitation is that the size of each dimension (e.g. width and height) of the spray you want to create must be a power of two (e.g. 2^5=32, 2^6=64, etc,) with the max being 256. So that means the following dimensional pixel lengths are allowed:

2, 4, 8, 16, 32, 64, 128, 256

Note though that the larger resolution you make the spray means less frames you can have in your animation. In order for source to accept your texture file as a valid multiplayer spray logo, it must be less than or equal to 131,072 bytes in length (other guides suggest 120k, but in reality it is 128k.) If you go too high of a resolution with too many frames, you'll easily go well over this limit.

The number of frames you can have at any given resolution highly depends on the content of each frame (if a highly compressible pattern exists,) and how much the graphic changes from frame to frame, among some other things. Generally you'll max out at 3 frames at 256x256 (if that, you'd need to have very little variation from frame to frame; this is perfect for creating a really convincing decoy spray that maybe has moving legs or arms) you can get around 15 frames at 128x128, anywhere from 24 to 60 frames at 64x64, and it goes *much* higher as you go lower. YMMV, again dependent on the animation (and texture compression, more about this later) you use though.

Also note that you can go above 256 in spite of what the guides say, all the way up to 4096 in fact. However, it is extremely difficult to even get one frame at 512x512 while staying within the size constraint. And to add to that; as of yet I am unable to determine if 512x512 has any image quality improvement over 256x256. I think the game engine may scale down all sprayed textures to 256x256 no matter how large they are. I am not certain.

FWIW, most other spray guides suggest that 92x92 works, but this is not the case (I am not sure where they got this from...HL1 texture specs? but then that was 96x96, not 92x92...) Even if you could get around the texture conversion software's filter and make a VTF file with an odd resolution such as that, the source engine has a limitation that will prevent it from loading these kinds of textures. Sucks I know but there aint sh!t you can do about it AFAICT.

There is one redeeming fact to that end though. Specifically, you don't have to use a 1:1 ratio for the image size of all sprays. E.g. instead of doing 128x128, you can do 128x64. Note that no matter what ratio you use, the spray will always show up as a perfect 1:1 square in the game. Therefore, doing this can benefit you in certain ways. Say for example you make a spray that is 64x64 and it only has 11 frames, and say you only use up about 60k in your VTF file. You can take advantage of the extra space available if you resize that to say 128x64. You'll get quite a noticeable image quality improvement in game, and you'll be at about say 118k instead, which makes for a more optimal "high detail" use given the restrictions at hand. Unless of course you feel bad for some dialup users on the server you connect to Here's an example of what kind of a difference 128x64 vs 64x64 can make:



Hint: sometimes flipping that to say 64x128 instead of 128x64 can give you better image quality results depending on the image, as per my example.


For those less familiar with adobe imageready: For resizing you go to image > image size...

Go ahead and type in the resolution you want. Uncheck the "constrain proportions" checkbox if you are going to go with the non 1:1 ratio suggestion I made. Also, you may or may not gain image quality improvements by selecting the bicubic smoother or bicubic sharper filters. Sometimes these filters can make the spray look awkward in source, depending on the image. Note that it is expected for the image to look squished in photoshop if you use a 1:2 (e.g. 128x64) resolution; if it doesn't then you did something wrong. It'll show up normal when you see it in game.



3. Now it is time to export your animation frames for use with VTFEdit.

With your final animation all ready to go, do the following in imageready:

file > export > animation frames as files...

You'll probably want to make it so that your frames are sequentially named with a leading zero automatically so that there's no manual tedious renaming involved, and you can make sure that the frame order turns out correct. I would suggest the following under the "set..." option in that window:

doc.name
frame no. (01, 02, 03 ...)
none
none
none
.ext

e.g:



(if you aren't going to use transparency in your spray, uncheck it here to end up with a smaller spray file size)

Be sure that the folder you select has no other image files in it (just so you don't get confused later, create a new one if you have to.) Also, set the format to PNG24. Then click OK. Don't worry if the total size of all of the image files combined is over 128k. When you convert them into a multi-frame texture in the next step, it'll be much smaller than that due to some texture compression used (you can choose between lossy and lossless texture compression in the next step.)

4. Now you use VTFEdit to create the texture file.

If you haven't already done so, extract the VTFEdit archive linked above somewhere on your hard disk, and run the VTFEdit.exe binary under the bin subdirectory. From there, go to file > import...

In that open dialog, navigate your way to the folder where you exported the animation frames using imageready. Select all of the image files and click "open."

Under the VTF Options dialog, make sure the "Texture Type" is set to multiple frame. You should probably uncheck the resize option since we already have it at the appropriate size, unless you aren't using imageready. Set the Normal format and Alpha format on DXT1 and DXT5 respectively, unless you have a reason to want to use any of the other compression formats.



Note: I haven't experimented enough to see if changing the compression format to something else has any positive impact, as I am not really a guru when it comes to 3D API's 'n stuff. I do know that DXT1 is lossy, however unlike jpeg I can't really tell the difference between DXT1 and a lossless compression (except for maybe a little blurring which I am uncertain of due to the filtering, but definitely no discoloration a la jpeg) when it is seen in-game as the numerous real-time graphics filters in place seem to be able to hide that somehow. But the potential small losses in image quality are well worth it here as you can easily fit *many* more frames into your animation at higher resolutions using DXT1 compression.

Next go to the options menu, and make sure that "Auto create VMT file" is checked (select it once to do so if not.)

Now you are ready for the last step, which is to save your texture file. But first, verify that the file size is small enough. Click on the info tab, and look at the number next to "Size:" This indicates how large your texture file will be when you save it; make sure that it is less than or equal to 128k. If it is higher, you'll need to go back to imageready and either delete some frames from your animation, or lower the resolution. If it is small enough, go to file > save as...

Name it whatever you want, and save it into the following directory:

C:\Program Files\Valve\Steam\SteamApps\<yourusername>\counter-strike source\cstrike\materials\VGUI\logos

Where <yourusername> is your steam login name.

That is it! Your CS:S spray is ready to go, just launch CS:S and select your new spray logo from the options menu. Remember that you can't change sprays while you are in a game. You have to change your spray and then reconnect to the server or else your new spray won't show up.

COPYRIGHT NOTICE: Don't wh0re this document like I have seen other howto's like this get wh0red. I know it may be tempting, but it took some time to research this and write it all up. If you want to give this information to others, link directly to this post located at http://www.nvnews.net/vbulletin/showthread.php?t=57233. Do not copy it to any other blogs/forums.
Attached Thumbnails
Click image for larger version

Name:	sidexside.gif
Views:	22042
Size:	87.2 KB
ID:	13514  Click image for larger version

Name:	options.gif
Views:	21369
Size:	16.5 KB
ID:	13517  Click image for larger version

Name:	resize.gif
Views:	21456
Size:	9.1 KB
ID:	13518  Click image for larger version

Name:	name.gif
Views:	21525
Size:	18.4 KB
ID:	13519  
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 09-27-05, 02:01 AM   #2
AthlonXP1800
Registered User
 
AthlonXP1800's Avatar
 
Join Date: Jan 2003
Location: United Kingdom
Posts: 4,352
Default Re: A better way to create animated CS:S sprays

Wow an animated sprays, I never seen one, is it worked in HL2DM too?
__________________
Intel Core i7 3770K, Corsair H80 liquid cooler with Noctua S12-1200 fan, ASUS P8Z77V with UEFI 2104, 16GB Samsung Green 30nm DDR3-RAM, Pioneer BDR-S09XLT 16x Blu-ray writer, Corsair AX850 PSU, Western Digital 2TB SATA3 hard drive, CanonScan LiDE 210 scanner, Microsoft Internet Keyboard, Microsoft Touch Explorer mouse, 32inch Sharp LC32LE600 LED TV, EVGA Geforce GTX 670 SC 4GB with Geforce 370.50 driver, 50Mb broadband Virgin Media VMDG480 Super Hub, Aspire Xplorer Midi Tower, Windows 8.1 Pro 64bit.
AthlonXP1800 is offline   Reply With Quote
Old 09-27-05, 02:06 AM   #3
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default Re: A better way to create animated CS:S sprays

Although I haven't tested it, it should. I suspect it would work in DoD:S as well.

EDIT: Here, try this spray.
Attached Files
File Type: zip boomheadshot.zip (67.5 KB, 1191 views)
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 09-27-05, 09:07 AM   #4
FierceDeityLink
Registered User
 
Join Date: Jul 2004
Posts: 390
Send a message via AIM to FierceDeityLink Send a message via MSN to FierceDeityLink Send a message via Yahoo to FierceDeityLink
Default Re: A better way to create animated CS:S sprays

I'd imagine this works well unless you want to do transparency, in which you'd have to go through every frame and make an alpha channel.

Yeah... I couldn't imagine doing this without ImageReady...
__________________
P4 3.2C|Asus P4C800-E DX|2GB Corsair DDR400|BFG Geforce 6800 Ultra|Antec TrueControl 550
Koolance EXOS 2|PolarFLO TT CPU|Danger Den NV-68|Danger Den MAZE4 chipset
FierceDeityLink is offline   Reply With Quote
Old 09-27-05, 12:22 PM   #5
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default Re: A better way to create animated CS:S sprays

Quote:
Originally Posted by FierceDeityLink
I'd imagine this works well unless you want to do transparency, in which you'd have to go through every frame and make an alpha channel.

Yeah... I couldn't imagine doing this without ImageReady...
Well, if the animation you start with already has an alpha channel it should work fine as long as you leave it enabled in imageready and make sure you use dxt5 in vtfedit.
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 09-27-05, 03:34 PM   #6
Edge
3d animator for hire!
 
Edge's Avatar
 
Join Date: Oct 2002
Location: Minnesota, USA
Posts: 3,564
Default Re: A better way to create animated CS:S sprays

Wow, thank you VERY much for this tutorial, I recently made a spray using the traditional methods that didn't turn out all that great, but this should really help me make sprays in much higher quality from now on.

Oh, just one thing to add: don't try to use your new spray right after you connect to the server (unless you've used the exact same spray on the exact same server before). It takes around 10-30 seconds for the spray image to get uploaded, so if you try to use it before then it will appear blank.

BTW, nice example picture to use for the resolution section
Edge is offline   Reply With Quote
Old 09-27-05, 04:52 PM   #7
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default Re: A better way to create animated CS:S sprays

Some other things to note as well; you can get interesting results by playing around with the mipmap and sharpen filters under the mipmap settings. It can make your spray show up better at further distances among other things.

If you get time, play around with all of the other settings in the image and info tabs, and under tools > create vmt file (you have to save it in the same spot where you put your spray texture) and let me know if you find any tricks to giving these sprays some good effects.

Also, I think I found an exploit while doing this. Theres a spray I created that makes all of the reflections on the map have a purple tint. Funny thing is this seems to affect the game for all of the other players in the server as well I accidently deleted that spray a few minutes ago and I am trying to see if I can reproduce it.

EDIT: Nevermind, I found the cause, it appears to be an intermittent bug in the source engine (must be recent, as in introduced by the latest patch) where the reflection texture doesn't load properly. The "pink" tint is caused by the familiar purple and black checkerboards that show up wherever there are missing textures. It seems that both clients happened to experience this bug at the same time.

BTW, if any of you texture guru's know how to control the timing of multi-frame textures, let me know.

EDIT: Found out how to do this as well, and theres a note on the SDK wiki that says this doesn't work for spray textures. Still looking further into it anyways.
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 10-10-05, 11:26 PM   #8
Edge
3d animator for hire!
 
Edge's Avatar
 
Join Date: Oct 2002
Location: Minnesota, USA
Posts: 3,564
Default Re: A better way to create animated CS:S sprays

I just have to bump this, this guide has been helped me more than I could've imagined.

One thing though: I've noticed that with transparent textures, the file size goes WAY up. For some reason I've only been able to succesfully use TGAs with the program, and they do work well as a trasparent image, but the file size is like twice as big as a non-transparent image. Looking at the configuration in VTFEdit, it seems it's using an 8 bit transparency map. Is there any way to force it to being a 2-bit trasparency or something, or better yet forcing the image itself to only be 8 bits of color and 2 bits of transparency? Because that would dramatically cut down on the size of the images.

Otherwise, it's worked out quite well for me. I was able to double the resolution of my animated sprays while keeping the file size just as big
Edge is offline   Reply With Quote

Old 10-10-05, 11:52 PM   #9
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default Re: A better way to create animated CS:S sprays

Hmm...I thought I put a note in there about transparent sprays and file size. Oh well, can't seem to edit it now regardless.

EDIT: Ah, it is in there, just a bit vague:

Quote:
Originally Posted by AlphaWolf_HK
(if you aren't going to use transparency in your spray, uncheck it here to end up with a smaller spray file size)
Anyways, I don't know about 2-bit, but I do know you can force it to 1-bit (e.g. the pixel is either fully transparent or it is fully opaque - nothing in between.) On the VTF options dialog, under the alpha format, scroll down below DXT5 a bit and you'll notice "DXT1 With One Bit Alpha." Select that and you'll save on the file size.

WRT 8-bit color, I am not sure about that. One of the other compression formats might do that. (I8? *shrug* I don't even know what most of these are.)

EDIT2: See here for a reference of what they all do:

http://developer.valvesoftware.com/w...#Image_Formats

Note that DXT3 and DXT5 do 4-bit alpha.

Also, P8 is paletted so there is your 8-bit texture. Doesn't have compression though. Nor is it supported by Source, so you are SOL there.

There doesn't appear to be any format with 2-bit alpha. Your choices are either 1, 4, 8, or in the case of HDR textures, 16-bit alpha.

Speak of HDR textures...those are 64-bit per pixel...

EDIT3: Also note the image flags:

http://developer.valvesoftware.com/wiki/VTF#Image_Flags

Specifically:

Quote:
Anisotropic Sampling 0x0010 High quality texture filtering.
That might be a good flag to enable for sprays. It will no doubt have no impact whatsoever on file size as it looks like a realtime filter. They probably allow different levels in order to optimize maps better (e.g. less looked at areas get lower filtering quality, thus you have a higher framerate while playing on the map.) No reason to not do it for sprays unless you are concerned about everybody elses framerate. Hell, if your system can handle it just fine, that gives you yet another advantage doesn't it? Well, not really. At most it'll drop their framerate by .001% or so since it is a pretty small texture.

Also of note is this flag:

Quote:
Nice Filtered 0x1000000
I don't know what exactly that does. You could also play around with disabling the mipmapping (basically, your spray stays the same quality no matter how far away from it you are.) See flags 0x0100, and 0x0200.

Not exactly the most considerate things to do with your sprays (in consideration of your peers' framerate that is,) but it'll sure as hell make them look prettier.

EDIT4: Also, I grabbed the latest version of VTFEdit which includes support for HDR textures, but they don't seem to work as sprays.
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 10-11-05, 07:43 PM   #10
Edge
3d animator for hire!
 
Edge's Avatar
 
Join Date: Oct 2002
Location: Minnesota, USA
Posts: 3,564
Default Re: A better way to create animated CS:S sprays

Hmm, unfortunately it seems that it still doesn't work right. The only alpha format that seems to work correctly is DXT5, which is an 8-bit format (though I was confused before, I actually was looking for a 1-bit alpha format, I forgot one bit was 2 color and two bit was 4 color). For some reason, using DXT1_ONEBITALPHA for an alpha texture causes total image corruption, while DXT1 gives absolutely no alpha, and all the other formats are a minimum of 8 bit. I tried using both PNGs and TGAs as the source format, and the result is the same for both. Darn, just when I thought I found a solution...

Thanks for the help though, that link is very interesting. At least non-alpha textures seem to be working fine for me. I was able to get 11 frames into a 128x128 image, if I knew of a way to turn BMPs/JPEGs to an animated gif easily I'd show it here.

Oh, and I thought that the name of one of those image formats was kinda funny. Alphabits...isn't that a cereal
Edge is offline   Reply With Quote
Old 10-11-05, 11:41 PM   #11
Rakeesh
 
Rakeesh's Avatar
 
Join Date: Jun 2004
Location: Sonoran Desert
Posts: 6,884
Default Re: A better way to create animated CS:S sprays

Quote:
Originally Posted by Edge
Hmm, unfortunately it seems that it still doesn't work right. The only alpha format that seems to work correctly is DXT5, which is an 8-bit format (though I was confused before, I actually was looking for a 1-bit alpha format, I forgot one bit was 2 color and two bit was 4 color). For some reason, using DXT1_ONEBITALPHA for an alpha texture causes total image corruption, while DXT1 gives absolutely no alpha, and all the other formats are a minimum of 8 bit. I tried using both PNGs and TGAs as the source format, and the result is the same for both. Darn, just when I thought I found a solution...
It could be that theres something additional that needs to be done for DXT1_ONEBITALPHA formatted textures to properly show up. When I see that kind of corruption, it gives me the idea that there is a mipmapping issue somewhere. Not sure what it is though.

EDIT: Actually I know what needs to be done. You need to make sure that there is only one level of transparency in your source image. E.g. there can't be any semitransparent pixels. If there are, it'll screw up.

As for your animated texture, thats easy to convert to gif if you use imageready. When you have the animation frames open, do file > save optimized as > then select gif.
__________________
Want to listen to audio without your computer going to sleep? Try this.

Core i7 2600k 4.4Ghz 1.385v | Corsair H60 | 8GB Corsair Vengeance 1600 8-8-8-24 | MSI P67A-G45 | OCZ Vertex 3 | Sapphire 7850 OC to Max settings

Rakeesh is offline   Reply With Quote
Old 10-14-05, 04:37 PM   #12
B08BO
Registered User
 
Join Date: Oct 2005
Location: MInnesota
Posts: 5
Default Re: A better way to create animated CS:S sprays

HEY wolf i used your tutorial. awsome but can you tell me how to slow down my spray becasue it is moving soo fast no on can read it or see what is says and can barely see the image on it , its 64x64 and can anyone out there gimme advice?
B08BO is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Valve's Source engine to power upcoming animated film News Archived News Items 0 06-10-12 09:20 PM
CSS filter effects get GPU-accelerated in Chrome News Archived News Items 0 06-05-12 01:20 PM

All times are GMT -5. The time now is 12:58 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Copyright ©1998 - 2014, nV News.