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.
Responses to “Announcing the VTFLib library…”
The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.