- Joined
- Mar 10, 2013
If you've recently played any of Valve's Source-engine FPS-es that allow "sprays," (i.e. user-supplied graffiti) you may have seen a "fade spray." They're animated sprays that change with distance instead of time, so you see one thing far away, another at an intermediate distance, and something else close up. (The quality varies - some are really good, while many of them just fade the far or near image to blank.) I've tried them in L4D2 and TF2, and AFAIK they should work in any of the (Source) Half-Life derivatives (excluding stuff like Portal).
Some of you may have enjoyed my extensive collection of CWC-related animated sprays, including JUUUULAY!, MY NAME IS NOT IAN BRANNON SOMETHING, manboobs, pizza comsumption, Flying Elephants, and several more. I haven't done any CWC fades yet, but I sussed out how they work and have some pretty good ones ifidosaysomyself. My method is easier than anything I've read on the 'Net, mainly 'cause it seems that most people haven't the foggiest idea of how textures work in Source so they make it way too complicated.
I use Gimp because I can't afford Photoshop (it makes me sad) so that's the procedure I'll describe. There's a plugin for GIMP that reads and writes .dds files, a Microsoft texture format (dds = "direct draw surface") widely used in videogames. There's a similar plugin for Photoshop; I haven't used it, but it can't be too different.
1) You will need this plugin: get it here.
Next, you need a way to convert .dds files into Valve's .vtf format. I use a public-domain utility called VPKTool, also known as "Quick & Dirty Bloodlines Texture Tool."
2) You need this too: click on something here to get it.
I'll start with a 2-image fade 'cause three frames is a lot more complicated & I'll get to how THAT's done in a future reply (ififeellikeit). I'm not going to explain all the gory details, so for now just Trust Me and make 'em 512 x 512 32-bit .pngs. It is imperative that the dimensions are even powers of 2 (like 512, which is a good size for other reasons), and the .png lets you use the lovely translucency of the alpha channel.
3) You need two 512x512 .png images. Call them "near.png" and "far.png" for the sake of this exercise.
Open "far.png" in GIMP, and export it as a .dds file. (The option for .dds export should automagically appear after installing the plugin.) In the "Save as DDS" options dialog, set:
Now open the .dds file you just created, and in the "Load DDS" dialog, check "Load mipmaps."
The .dds data will have ten layers. The topmost is called "main surface." The rest are "mipmap 1" through "mipmap 9". Open your near image (in this example, "near.png"), select all, and copy it to the clipboard. Go back to the .dds file and paste it in. You can just "anchor" the layer, which will replace the contents of "main surface," or you could make a new layer (after pasting), delete "main surface", and rename your new layer to that. The goal is to have the near image on the top layer, and the top layer has to be named "main surface".
(You'll notice that the mipmap layers are each half the width and height of the previous layer, i.e. since "main surface" is 512x512, mipmaps 1 through 9 will be 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, and 1 pixel in that order. This doesn't matter too much right now, but it figures into making a 3-frame fade later.)
Export the newly fiddled .dds file out under another name (go ahead, be creative), only this time in the "Save DDS Options" box, set the "Mipmaps:" choice to "Use existing mipmaps".
Fire up VPKTool. Click the "Texture tools" tab, and then the "Open file" button. Browse for your new .dds. After you load it, click the "Convert DDS to VTF" button on the right side.
That's it. Copy the thus-produced .vtf file to wherever you put your sprays, and import it into the game from the main menu. It won't show the right frame in the preview, usually, and it doesn't animate, but you should be able to baffle your friends and confound your enemies the next time you're online.
You're Welcome,
=s
P.S. I used these for a three-frame fade; you could just leave one of 'em out and do a two-framer as described above, or wait until I cast the secret of three frames like pearls before you.
Some of you may have enjoyed my extensive collection of CWC-related animated sprays, including JUUUULAY!, MY NAME IS NOT IAN BRANNON SOMETHING, manboobs, pizza comsumption, Flying Elephants, and several more. I haven't done any CWC fades yet, but I sussed out how they work and have some pretty good ones ifidosaysomyself. My method is easier than anything I've read on the 'Net, mainly 'cause it seems that most people haven't the foggiest idea of how textures work in Source so they make it way too complicated.
I use Gimp because I can't afford Photoshop (it makes me sad) so that's the procedure I'll describe. There's a plugin for GIMP that reads and writes .dds files, a Microsoft texture format (dds = "direct draw surface") widely used in videogames. There's a similar plugin for Photoshop; I haven't used it, but it can't be too different.
1) You will need this plugin: get it here.
Next, you need a way to convert .dds files into Valve's .vtf format. I use a public-domain utility called VPKTool, also known as "Quick & Dirty Bloodlines Texture Tool."
2) You need this too: click on something here to get it.
I'll start with a 2-image fade 'cause three frames is a lot more complicated & I'll get to how THAT's done in a future reply (ififeellikeit). I'm not going to explain all the gory details, so for now just Trust Me and make 'em 512 x 512 32-bit .pngs. It is imperative that the dimensions are even powers of 2 (like 512, which is a good size for other reasons), and the .png lets you use the lovely translucency of the alpha channel.
3) You need two 512x512 .png images. Call them "near.png" and "far.png" for the sake of this exercise.
Open "far.png" in GIMP, and export it as a .dds file. (The option for .dds export should automagically appear after installing the plugin.) In the "Save as DDS" options dialog, set:
- Compression to "BC3 / DXT5"
- Mipmaps to "Generate mipmaps"
Now open the .dds file you just created, and in the "Load DDS" dialog, check "Load mipmaps."
The .dds data will have ten layers. The topmost is called "main surface." The rest are "mipmap 1" through "mipmap 9". Open your near image (in this example, "near.png"), select all, and copy it to the clipboard. Go back to the .dds file and paste it in. You can just "anchor" the layer, which will replace the contents of "main surface," or you could make a new layer (after pasting), delete "main surface", and rename your new layer to that. The goal is to have the near image on the top layer, and the top layer has to be named "main surface".
(You'll notice that the mipmap layers are each half the width and height of the previous layer, i.e. since "main surface" is 512x512, mipmaps 1 through 9 will be 256x256, 128x128, 64x64, 32x32, 16x16, 8x8, 4x4, 2x2, and 1 pixel in that order. This doesn't matter too much right now, but it figures into making a 3-frame fade later.)
Export the newly fiddled .dds file out under another name (go ahead, be creative), only this time in the "Save DDS Options" box, set the "Mipmaps:" choice to "Use existing mipmaps".
Fire up VPKTool. Click the "Texture tools" tab, and then the "Open file" button. Browse for your new .dds. After you load it, click the "Convert DDS to VTF" button on the right side.
That's it. Copy the thus-produced .vtf file to wherever you put your sprays, and import it into the game from the main menu. It won't show the right frame in the preview, usually, and it doesn't animate, but you should be able to baffle your friends and confound your enemies the next time you're online.
You're Welcome,
=s
P.S. I used these for a three-frame fade; you could just leave one of 'em out and do a two-framer as described above, or wait until I cast the secret of three frames like pearls before you.


