Team Fortress 2

Team Fortress 2

56 个评价
How To Make 1024x1020 Sprays Manually (DDS -> VTF Tool)
由 GreenSwede 制作
This guide will show you how to make high definition 1024x1020 resolution sprays for use in TF2 (and other Source games) with the help of a custom DDS to VTF converter, without going above the 512 KB file size limit!
   
奖励
收藏
已收藏
取消收藏
"This shouldn't be possible..."
You might be asking yourself how a VTF spray can go beyond a 512x512 resolution while still being less than 512 KB big. Well to put it simple, there is a way to make VTF textures with odd resolutions. By converting an 1024x1020 (or 1020x1024) image into the DDS texture format by saving it with DXT1 1 bit alpha compression, you can convert that into the VTF file format which the game happily accepts for some obscure reason!

You might also be asking yourself why the resolution only goes up to 1024x1020 instead of 1024x1024. Shouldn't textures always have to be a power of 2 (128x128, 256x256, 512x512)?
Well, this method somehow breaks that rule. The VTF texture format can[/c] allow resolutions that aren't a power of 2 even if the game technically only expects power of 2 textures. This allows the spray file to stay under the 512 KB filesize limit. VTF files which are made using this method will have a filesize of approximately 510 KB, just 2 KB short before reaching the Source engine limit.

TL;DR let's just say magic is involved.
"but i want to do this on the web instead!"
You're in luck as I have also made a guide which does the same thing, except it's a website that handles the conversion for you. Be advised that the colors may have more artifacts when using this webpage. The exact cause for this is unknown, but converting the image from a DDS file to VTF manually generally gives better results based on my own testing. Don't take my word for it though, your results may vary depending on the image used.
https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1282767477
Prerequisites
This guide will be going through the following tools on how to convert an image into the DDS format and how to convert it into a VTF texture file, as well as how to do some basic editing on your image:
  • VTFEdit[www.tophattwaffle.com](v1.3.3 used for this guide)
    Used to make adjustments to the spray's properties and make it not lose any level of detail among other things.

  • GIMP[www.gimp.org] (v2.10.12 used for this guide, however other/newer versions also work fine)
    Used to import images, modify them and export them.
    You will need this DDS plugin to export your image into the DDS format:
    https://code.google.com/archive/p/gimp-dds/downloads

    Select the win64 or win32 download depending on your OS.


  • Photoshop (CC 2019 used for this guide, however other/newer versions also work fine)
    Does the same things as GIMP, except the NVIDIA DDS plugin it supports includes more features.
    You will need this DDS plugin to export your image into the DDS format:
    https://developer.nvidia.com/nvidia-texture-tools-adobe-photoshop


  • Quick and dirty Bloodlines Tools v3.9a
    Used to convert the DDS file to VTF so that it can be used as a spray.
How To Use GIMP


First time using GIMP? You may want to click on "Windows" and make sure "Single-Windowed Mode" is selected before continuing with the guide.

Before you begin, make sure to drop the dds.exe plugin file into the GIMP plugin installation directory. It is often found in: C:\Program Files\GIMP 2\lib\gimp\2.0\plug-ins

Scaling (resizing) the image
  1. Scale the images by going to Image > Scale Image.

    Make sure the image size is a power of 2 (1024x1024).

  2. To scale the images so it has the same width and height proportions, click the chain icon so it is broken like the image below:



  3. You can change the interpolation to suit your needs. Cubic and Linear can look better than one another depending on the image that you had to scale down/up. More info here: https://docs.gimp.org/2.10/da/gimp-tools-transform.html

Cropping the image into a 1024x1020/1020x1024 resolution
  1. The easiest way to make sure that the X/Y image resolution is reduced to x1020 is by using the Image > Canvas Size... option. Reduce either the width or the height so the pixel count is set to 1020 like the image below.




  2. Cropping images can be useful in many scenarios to prevent images from becoming stretched/squished if the proportions are uneven. If you want to crop the images without scaling it up/down, use the Crop Tool (shortcut: Shift+C).

    Click the dropdown list to change from Aspect Ratio to Width, Height and Size. The fixed size can be adjusted. Holding Shift while dragging the cursor using the Crop Tool will also force it to be a fixed size.

  3. If your image is transparent and you want to crop to the content inside the image (remove the transparent pixels until the very edge of the frame/canvas), click on Image > Crop to Content.

Exporting the image as a DDS file
  1. Now that your image is either in a 1024x1020 or 1020x1024 resolution, go to File > Export As...




  2. Click on Select File Type (By Extension) and select DDS image and after that click on Export.




  3. You should now have another window open with the DDS settings. Select BC1 / DXT1 as the compression type, then click on OK. Make sure you have set the same settings as the screenshot below.



    Sometimes when exporting images that contain transparency, there may be some visible artifacts along the hard edges as a result of the DXT1 1-bit alpha compression. You will notice if they exist if you find any squares (usually grey) along the transparent pixels. You can see how it looks and how to fix it in the Photoshop section down below. This can be fixed using GIMP also.

Congratulations, you're all done! Continue to the Quick and dirty Bloodlines Tools instructions.
How To Use Photoshop


Make sure to install the DDS plugin first by running the Nvidia installer.

Scaling (resizing) the image
  1. Scale the image by going to Image > Image Size...

    Make sure the image size is a power of 2 (1024x1024).

  2. To scale the image so it has the same width and height proportions, click on Constrain Proportions so it is unchecked.

  3. You can change the resampling used when resizing your image to suit your needs.

    Bilinear is what I personally use the most when it comes to resizing images. There are times when I may want to use the other resampling options however as it depends on the image used. For a good summary of what they all mean, look at the parentheses.

    Nearest Neighbor is best used for pixel art featuring pixels and hard edges. If you use it, divide/multiply the source material's size by 2/3/4 for an example so all pixels stay the same size. Count the pixel size so you do not accidentally mess up the size of the pixels.

Cropping the images
  1. The easiest way to make sure that the X/Y image resolution is reduced to x1020 is by using the Image > Canvas Size... option. Reduce either the width or the height so the pixel count is set to 1020.

  2. Cropping images can be useful in many scenarios to prevent images from becoming stretched/squished if the proportions are uneven. If you want to crop the images without scaling it up/down, use the Crop Tool (shortcut: C).

    Click the dropdown list to change between different fixed sizes. Unconstrained allows you to drag the crop tool freely with any proportions you want, while 1 x 1 (Square) restricts it to a square. Hold shift to make it fixed.

  3. If your image is transparent and you want to crop to the content inside the image (remove the transparent pixels until the very frame), click on Image > Trim...

Exporting the image as a DDS file
  1. Now that your image is either in a 1024x1020 or 1020x1024 resolution, go to File > Save As...

  2. Click on the file type drop-down list and select D3D/DDS.

  3. Once you click on Save the NVIDIA dds Format window should show up.



    Make sure "DXT1 ARGB 4 bpp | 1 bit alpha" is selected and that No MIP maps is selected. It also has to be a 2D Texture.

    Before exporting the image as a DDS file, you can click on the 2D Preview button to see how it looks. The image will likely have some minor artifacts due to the DXT1 compression format, but that's normal. Just take a look and see if there are any issues.

    Update: The DDS plugin UI has been updated. Use the below screenshot as reference for the settings that you need:




    Sometimes when exporting images that contain transparency, there may be some visible artifacts along the hard edges as a result of the DXT1 1-bit alpha compression. You will notice if they exist if you find any squares (usually grey but colour may vary) along the transparent pixels. They look something like this:



    To fix this, you may want to make sure the pixels are completely transparent, meaning they should have 100% opacity (not be see-through). Because of this, it's recommended to not use anti-aliasing when adding transparency. Using anti-aliasing does work in some cases, but it's mainly up to the source image and the way you make the image transparent. This issue is also more common when there are JPEG artifacts visible on the image. If there are JPEG artifacts, try cleaning up a few of the problematic pixels in the area with the Eraser tool or the polygon lasso tool and they should disappear. This is usually a trial and error process so this may take some extra time if you're unlucky. Use the 2D Preview continuously after each change until you notice that they're gone.

    If the source image has too many JPEG artifacts, try using this website which helps de-noise artifacts (it is incredibly useful for artwork): http://waifu2x.udp.jp/


  4. Once the settings look fine, click on Save.

Congratulations, you're all done! Continue to the Quick and dirty Bloodlines Tools instructions.
How To Use Quick and dirty Bloodlines Tools
Now that you are done with either the GIMP walkthrough or the Photoshop walkthrough, it is time to guide you through the simple and effective Quick and dirty Bloodlines Tools where the magic happens.

Converting the DDS to VTF
  1. Click on the Texture Tools tab and click on Open file. Browse and select the DDS file you exported previously.

  2. Now with the image opened, simply click on Convert DDS to VTF and you should now have a VTF file saved in the same directory as the DDS file.
Well that was easy. Now all that's left is to edit the VTF file's properties using VTFEdit so we can make it look even better.
How To Use VTFEdit
Modify the texture's property flags
  1. Open up VTFEdit and click on File > Open

  2. Browse to the destination where the VTF file was exported and click on Open

  3. If you have followed all the instructions correctly so far you should be able to see your spray in the preview window in VTFEdit right in front of you.



    If your image has a transparent background and it looks weird/messy in VTFEdit, it could be due to the missing mipmaps depending on what your image looked like prior to editing it. This is normal and should look fine once the spray is in-game. If the transparency is still broken in-game, you may have exported the DDS file previously with the wrong compression type. It should also be noted that transparency does not work in Linux builds of the game.

    The Image tab allows you to see and modify the spray's flags. Each flag gives the spray a different property where most of them change the way the spray looks. A couple of flags you may want to be aware of are:

    No Mipmap (we skipped including mipmaps so this can be enabled)
    No Level of Detail (spray quality is not affected by players' texture quality setting)
    Clamp S (often used for sprays that are transparent, clamps S coordinates)
    Clamp T (often used for sprays that are transparent, clamps T coordinates)
    Point Sample ("pixel art" texture filtering, works great for sprites and pixelated art)

  4. Once you're happy with the flags selected and how the image looks, it is time to save it as a VTF file!

    Click on File > Save As... and give the spray a name and save it wherever you want.
How To Import The Spray
Now that you have the final VTF texture file, it is time to import it to TF2. If you already know how to import sprays to TF2 manually then you can ignore this section of the guide.

Importing is done very easily. The game requires a VMT file for the spray, which is necessary to have in order for the game to find your texture. The easiest option for most people to generate it is to:

  1. Open up TF2 and head down to Options > Multiplayer
  2. Click on Import Spray
  3. Browse to the VTF file and import it

After that is done, the spray should now be in the list of selectable sprays in the options menu.

You can also use VTFEdit to generate the VMT file manually by opening the VTF file and clicking on Tools > Create VMT File. Just be to sure to open the VTF after placing it in your game folder first (typically tf/materials/vgui/logos) or the path it generates in the VMT file will be incorrect.
You're All Done! 🎈
Congratulations, you now have a 1024x1020/1020x1024 resolution spray! Be sure to spray it everywhere and show off how good your new spray looks. As a special bonus the spray does not include mipmaps or any level of detail, which makes it look extra crisp (the spray will look the same for all players, even for those who are running TF2 on toasters with texture quality set to low).



If you want to take a closer look at the spray that I created above, you can download it from here: amy_rain[cdn.discordapp.com]


Check out my other guide if you want to learn how to make animated sprays using VTFEdit!
http://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1288408087
26 条留言
GreenSwede  [作者] 2021 年 9 月 17 日 下午 11:26 
After the recent update, this cvar has to be set to 0 to allow sprays to be used and visible:
cl_spraydisable 0
GreenSwede  [作者] 2021 年 4 月 21 日 下午 1:10 
Apologies for the late reply.

Make sure you do not include mipmaps. If you use Photoshop then the DDS window should have the "Generate Mipmaps" button unticked . If the file size says 522kb in the bottom right corner, it should be good to go.

If you use GIMP on the other hand, make sure you do not generate mipmaps (look at the GIMP screenshot in the guide for reference).

If the file size is still too big, you may use the wrong compression/format. Also, if the file size is 512 kb and not 510 kb then something odd is happening when you export the image in the given resolution. Can't explain why that happens, but someone had similar issues when using GIMP. I have not been able to replicate it, please double check that all settings are correct if you do use GIMP.
BotherRed 2021 年 2 月 9 日 下午 3:11 
I have followed your walk though, every step, everything, and every time I get a message saying its too big of a file when I'm loading into Map_itemtest and it just doesn't work.
BotherRed 2021 年 2 月 9 日 下午 1:33 
I think I have done something wrong, the file isn't opening after I use Quick and Dirty to VTFEdit
GreenSwede  [作者] 2021 年 2 月 9 日 下午 12:55 
With this method to keep the transparency, yes it has to be.
BotherRed 2021 年 2 月 9 日 下午 12:51 
Does it have to be DDS for the file type?
olimac 2020 年 9 月 8 日 下午 9:34 
Thank you! :)
HurricanePootis 2020 年 7 月 2 日 上午 2:21 
Thank you so much for this guide! Recently I've been going down a rabbit hole of customizing my sprays. Recently, I made a spray that changes when you get close to it.
Rarky 2019 年 12 月 15 日 上午 6:37 
So I ended up trying both GIMP version 2.8 and 2.10, with 2.8 being the versions that I primarily use as I personally am not a fan of 2.10. Both versions gave me the same results.

However when I now tried doing the whole thing with Photoshop instead, it worked. The saved DDS file when exported via Photoshop would remain a 1024x1020 whilst being only 510 KB in it's file size, it too would remain a 1024x1020 when I would run it through Quick and Dirty Bloodlines.

I have still yet to figure out why I can't get it to work when working with GIMP. It kinda pains me because I much prefer GIMP to Photoshop, but I got it to work with Photoshop in end, and so I'm happy with that. You may or may not include awareness of the possibility of GIMP not doing the trick in your guide, but I digress. Thank you for this guide.
GreenSwede  [作者] 2019 年 12 月 15 日 上午 4:37 
That must mean that either GIMP or the DDS plugin forces it to a 1024x1024 resolution.

The DDS plugin version I tried that worked is gimp-dds-win64-3.0.1 and GIMP version 2.10.14