VTFLib is a LGPL open source programming library, written by Neil Jedrzejewski and I. VTFLib provides a C and C++ API that, with a few simple functions, can open and save .vtf and .vmt files, providing access to all known features. The library functions independent of Steam, allowing third party applications to use the library without Steam present or runningi on the target system.
VTFLib includes two GPL example applications, VTFCmd and VTFEdit. VTFCmd is a C command line frontend for VTFLib that can create .vtf and .vmt files from various source formats. It is similar in functionality to Valve's vtex Source SDK utility, but offers a lot more control. VTFEdit is a C++ .NET graphical frontend for VTFLib with viewing and creation capabilities. Both VTFCmd and VTFEdit support several source image formats, including, but not limited to .bmp, .dds, .gif, .jpg, .png and .tga.Screenshots:
- Convert .bmp, .dds, .gif, .jpg, .png and .tga files to .vtf and .vmt files with easy access to all .vtf options.
- Convert .vtf files to .bmp, .jpg, .png and .tga files.
- Convert entire folders to and from .vtf and .vmt files.
- Convert .wad files to .vtf and .vmt files.
- Explore .bsp, .gcf, .pak, .wad and .xzp packages.
- Preview .vtf files.
- Recent file menu.
- 100% Free.
Some features we are working on for the next version (if you have any requests let me know):
- .vmt C creation routines.
- Basic .vmt creation (similar to vtex).
- Paste as new.
- Alpha mask.
- Integrated file system browser.
You can find a preview here.
So please, mark one as the exe style, as you have with your other tools
PS, VERY GOOD WORK on the wad convertor!
It would be helpful if someone could provide templates for the various typical .vmt files (normal texture, bump mapped texture, HUD texture, sprite, etc).
Glad you like the .wad converter.
I using .net framework korean. pleaze help~
A emty material for wold geomaty
--commands you can have in it--
//Defuce texture (path is relative to materials folder, no .vtf)
//2 sided material
//normal map bump mapping
//8 bit transparency (uses the alpha form the basetexture)
//1 bit transparency (uses the alpha form the basetexture).
//material type (affects the sound and decale when hit)
(I'll give you a list of posibles later on).
thers alot more stuff you can put in there as weal ill try to give you some more if you want.
If you enable Auto Create VMT File from the options menu, it will create a VMT with a $basetexture and a default shader whenever you save a VTF file. If you select Create VMT File from the Tools menu, you can specify all of the above options and create your VTF files. In order for the paths to be correct, your VTF file must be in a materials folder.
Would it be posible for you to make a option to extract a vmt and all it's related .vtf files from the gcf file?
Also, the binary archive download doesn't have VTFCmd in it.
And VTFCmd is in the binary archive, it is in the bin folder.
I am looking to add a buy zone to cs source map dotd_hellhold(I only have the bsp file).
Any suggestions would be appriciated.
Can someone tell me where a tutorial is or make one?
I had read that vtfedit converts .vtf files into tga files. I have done this, but can it convert more than one at a time?
- Select Tools->Convert Folder.
- Set the Input Folder to the folder with your .vtf files.
- Set the Output Folder to the folder you want the .tgas to go.
- Set the Filter to *.vtf.
- Press Convert.
I mistook the batch convert section as looking to convert .tga's to .vtf.
Also, let me say thanks for these very sweet tools. I began my mapping days with Doom! It's a wild trip to see things get to where they are and these tools you have created sure to do make it a great deal more fun.
p.s. (lol...this is giving me a huge smile. I wish kids were this easy to deal with!)
As a work around, you can manually set the paths by setting the following two variables in your VTFEdit.ini file (before running VTFEdit):
I will try to come up with a workaround if I can, but there isn't really an elegant solution. GCFScape had this same problem and I ended up converting it to .NET v2.0 (which doesn't have this bug). Unfortunately converting s a royal pain in the ass.
EDIT: Nevermind I went back and took the three bmps those files originally came from and the program converted fine. Excellent program!!! Just setup a shortcut to the .ini!
ok brown nosing aside :P I'm using a scope image with my sniper rifle in my mod, and i'm having a lil trouble. i'm using a quarter circle image (with an alpha channel) and drawing it 4 times (rotated) to make a complete circle. i think the engine is softening the edges, because i get faint ghost lines in between the seams. you can view a screenie of it here:
any chance there's some VTF flags or VMT commands to prevent this from happening?
If that doesn't work, email me your .tga and .vtf file and I'll have a look.
Also, have you tried looking at existing scope materials?
btw i had No Mipmap ticked already, so it was one of the other 3.
The No Mipmap flag tells Direct X not to use the texture's mipmaps and is only recommended if your texture is never sized much smaller than its actual size (e.g. GUI elements or your scope or (sometimes) skyboxes). It will cause your texture to be rendered with a linear filter instead of bilinear, trilinear or anisotropic (which all require mipmaps).
No Level Of Detail tells the Source engine not to use a smaller resolution subset of the texture's mipmaps. There are a lot of 1024x1024 resolution textures in Half-Life 2, but most video cards only load the 512x512 or even 256x256 and lower resolution mipmaps because they don't have sufficient memory or bandwidth. No Level Of Detail forces the video cards to load and use the largest mipmap which means your texture will preserve a high level of detail.
That sentence was so long I have to visualize it a bit I guess:
Steal rock bitmap from rock/grassblend texture shown in material editor > combine that rock bitmap with my own bitmap of same size > Add it so that I can see it in Hammer and furthermore in game > Get everyone who downloads the map to be able to use the newly created blend texture.
Any good tutes on this?
I already tried: http://forum.interlopers.net/viewtopic.php?t=1802 and
But I only got empty 64x64 texture showing in material browser using those tutorials.
I followed all the instructions, but vftedit does not have Multiple Frame in the Texture Type drop down options. It has Animated Texture, Environment Map, and Volume Texture... that is it. And none of those will work for me.
My file is 11 frames at 128x128 and is below 120k.
Any advice on why vftedit has this menu option for some but not all?
As long as your .vtf is small enough and you create a .vmt (it just needs to be the same as the other generated .vmt files) your animated .vtf should work. I've made several myself and have never had problems.
I just see a checkbox that says clamp with minimum height and width.I couldnt see anything in the readme about how to do it via command line either
- Select File then Import and select your image source.
- Select the VTF Options you want (these are options that relate to image generation), and then press OK.
- Under the Image tab, select the Clamp S and Clamp T flags.
- Select File then Save As and save your texture.
I'm guessing the problem might be somewhere beginning with step 3. Thanks for any help Nem.
Just an unrelated tip but: if you're making a spray, it's a good idea to disable mipmap generation as it will produce smaller .vtf files (so you can have more frames) and generally increase the in-game quality.
Can I also use C wrapper as VTF Explorer??? If I can, then how???
Can anybody explain me spet by step, how can I load the *vtf file and show it on the window??? Please!!!! It is too important for me!
Thank you Nem and thanks evrebody!!
Here is what I'm doing:
procedure TForm1.Button1Click(Sender: TObject);
PRGB = ^TRGB;
TRGB = array[0..2] of Byte;
var VTFImage: Cardinal;
ImgData, AlphaData: string;
Width, Height: Cardinal;
V: array[1..2] of Single;
lpBuffer1, lpBuffer2: PByte;
Source, DestAlpha, DestImg, pSource, pDestAlpha, pDestImg: PChar;
i, j: integer;
uiR, uiG, uiB: Cardinal;
// Zagrujaem biblioteku
if LoadVTFLib=true then
if vlCreateImage(@VTFImage)=false then
ShowMessage('Error creating file!');
if vlBindImage(VTFImage)=false then
ShowMessage('Error binding image!');
if vlImageLoadLump(pointer(RawBuffer), length(RawBuffer), false)=false then
ShowMessage('Error loading stream to memory!');
HasAlpha := (vlImageGetFlags() and (TEXTUREFLAGS_ONEBITALPHA or TEXTUREFLAGS_EIGHTBITALPHA))<>0;
if HasAlpha then
if (Width>46340) or (Height>46340) then
ShowMessage('Unable to load VTF file. Picture is too large.');
NumberOfPixels:=Width * Height;
uiBufferSize:=vlImageComputeImageSize(Width, Height, 1, 1, ImageFormat);
lpBuffer2:=vlImageGetData(0, 0, 0, 0);
if vlImageConvert (lpBuffer2, lpBuffer1, Width, Height, vlImageGetFormat(), ImageFormat)=false then
ShowMessage('Unable to load VTF file. Call to vlImageConvert failed.');
In this way I have loaded VTF file, converted it to RGB format and load bytes to lpBuffer1!
Now, the problem is that how can I show the image data???
Am I doing anything wrong???
Thanks for Evrebody!!!
So far I've created working .vtf and .vmt files, as well as adding new lines to my mani skins files. But when I use ma_setskin to change to the new skin, it still has the old one on.
The ma_setskin works perfectly, it has changed to the new skin as it says so in the console, and the new skins were even downloaded upon entering the server. But the same texture from the old model remains.
I also haven't edited anything else apart from what's listed above.
What can I do?
After quite a research it turned out the source is not the VTFEdit itself, but the VTFLib that it uses.
After one more day in looking into the source code I found out that the NVIDIA TEXTURE TOOLS Library, used by VTFLib for some of its functions, is causing the problem.
Here are my notes:
Importing Image with resulution 4096^4096 few times:
DXT Compression - ok (not 100% sure)
thumbnail generation - minor LEAKs (~10MB for that image res!)
mipmap generation - minor LEAKs (another ~10MB)
resizing 3000 to 4096,- big LEAK (>70MB)
normalmaps generation - major LEAK (>200MB, 50MB for 2048x2048 image)
NOTE that if you NOT use these functions everythings works great - after importing the same file again the memory usage (in task manager) returns to the same value before importing the same image as already imported)
NOTE also that for smaller images the leaks are smaller but are thare!
You can try all this yourself.
Im looking for good texture manipulation library myself, that is why I have done such an investigation:)
Comments (on the issue) and directions (for the lib) are welcome!
sorry for my english
I have troubles modifying a reticle for the game dark messiah.
I opened reticle_spell.vtf in VTFedit, and it shows 2 channels 1 rgb (with small white circle and black background)
and 1 alpha (which shows the actual reticle)
I export the file to TGA then I open it in GIMP.
However I can't find the alpha channel in GIMP despite looking in channel list.
Do you know what I missed here?
Also if I want to change the reticle drawing? will I have to modify both RGB and Alpha or only Alpha is necessary?
Thanks for your kind help !
I found the alpha channel, but unfortunately its all black, no drawing of the reticle, like it was showing up in vtfedit.
Thanks for the info. I wonder if NVDXTLib keeps the texture data in memory (and returns pointers to this data in the callback) until the next call. Either way, the memory usage seems excessive.
I don't have a lot of time to look at this at the moment, but if I get a chance I'll see if I can't find a workaround. NVDXTLib has always been quite buggy, I've had trouble with every release, but it seems to be getting better.
I've confirmed that VTFEdit is exporting .tga files with proper alpha channels. I'm not really familiar with the GIMP, so I can't really provide any more help than to say they are there; good luck figuring it out. Maybe ask here?
And what about the ability to export to a PNG?, lossless and has 8Bit alpha support.
Edit: I don't want to come off sounding like some whiny user demanding things though (So sorry if I do), these are just thing's I'd like at some time in the future (At the moment I have to transfer the exported TGA's to my mac and save it as a PNG to get the Alpha channel in GIMP, so straight export to PNG would save me some time).
And GIMP can open the TGA files, but it doesn't load the alpha channel, and IrfanView (another app I use) treats the alpha channel as if it was 1Bit, but if I open the PNG I converted on my mac, and re-save as TGA in GIMP, then GIMP and Irfan View can see the full alpha channel.