Apr. 18, 2005 @ 23:45

It’s done. Sort of…

Nem and I are happy to announce the release of VTFLib, our C++ library and DLL allowing third-party applications to support VTF and VMT files without the need for Steam or the Source SDK.

Theres not much more one can say here about it, but a full description of what it can do and how to use it can be found on the Source tools page along with the source & binary downloads, plus reference documentation.

And with that, I’m off to bed…

For far too many weeks now, myself and Nem have been putting together a programming libary to allow developers to add support for VTF and VMT files in their applications. Apart from “doing it because we can”, its goal is to help 3rd party apps, such as image editing or 3D software, to work directly with the image format through a nice easy API. The full list of features of VTFLib is pretty long but here’s a quick run down.

What is VTFLib do?

VTFLib is an open source programming library which allows developers to add support for VMT and VTF files used by the material system of Valve Software’s Source game engine. It functions independent of Steam allowing third party apps to use these file types without the need for Steam to be running.

VTFLib offers a simply API which allows you to read or write VMT and VTF files through a few simple functions. It also takes care of a lot of formatting and validation of the files.

What can VTFLib do?

VTFLib comprises of two modules, VMTFile and VTFFile.

VMTFile allows you to read and write VMT files using a hierarchical node based system similar to how one might navigate an XML file. The system uses a series of VMTNode objects which have a name and data type. These can be set, read or parented as needed by your application.

You can load an existing VMT file, navigate and modify it or create a new file from scratch. VMTFile will handle indentation and formatting of the file output.

The VTFFile module allows you to read and write binary image data in VTF files. Internally, the module uses RGBA8888 (32-bit) data for images and requires either your own functions or a 3rd party library to read and write more common image formats. We use and have tested it with DevIL.

It supports single frame, multiple frame and cube map files and can read and write compressed and uncompressed formats and allows access to individual frames, faces and MIP levels. It contains functions to automatically create MIP levels for you using a number of different filter types, can automatically generate sphere maps and even create Normal and DuDv maps from RGB and greyscale source images.

To give you an idea just how yummy it is, using DevIL as well as VTFLib you can write an application to convert a JPEG or TGA file to a VTF file, creating MIPMaps and using advanced filtering in around 20 lines of code.

One of my personal favourites is the fact VTFLib offers around 10 different filters when making MIPMaps over Valves one and can create Normal and DuDV maps on-the-fly from source images using the same methods as nVidia’s Photoshop plugins.

The library is pretty much complete, bar some final tests and is just awaiting the documentation to be written (my job! :-/) prior to release.