VTFX Reader converts VTFX files to PNG's. Supports LZMA compressed resources as well as big endian formatted resources. Written in rust.
- Supports 360 vtf files [*.360.vtf]. DXT endianness is automatically fixed.
- PS3 files [*.vtf].
Note
Xbox 360 vtfx's usually have multiple mip levels packed into the main resource, the largest(best) mip level will be exported.
Common tools such as VTFEdit only support vtf files made for PC versions of source engine. PS3 and X360 versions of source use VTFX which are specially formatted for these platforms. This means they cannot be read by existing tools without special logic.
- DXT1
- DXT5
- RGBA16161616
- BGRX8888
- RGBA8888
- ABGR8888
- RGB888
- BGR888
- ARGB8888
- BGRA8888
Untested support for:
- LINEAR_BGRX8888.
Compressed (LZMA) and non compressed images are supported. By default alpha is not exported, but can be enabled with the --export-alpha
argument.
Files detected to be for the xbox 360 (v 864.8) that are in the image formats IMAGE_FORMAT_DXT1, IMAGE_FORMAT_DXT3 or IMAGE_FORMAT_DXT5 will have their endianness converted before decoding (otherwise the output will have corrupted color). PS3 files (usually v 819.8) do not need this.
Download the latest release and run via cmd/powershell/terminal using the command line arguments listed below to specify the input files and options.
e.g. ./vtfx_reader -i foo.vtf
to process the file "foo.vtf" in the same folder
Usage: vtfx_reader.exe [OPTIONS] --input <INPUT>
Options:
-i, --input <INPUT>
Input path (process single file) or folder (processes all vtf files in folder)
-o, --output <OUTPUT>
Output folder for exported images
--export-alpha
If alpha should be included in image export
--force-dxt-endian-fix
Force apply big to little endian fix on DXT image resources (otherwise automatic)
--no-resource-export
Do not export any resources
--open
Auto open exported images
-h, --help
Print help (see a summary with '-h')
-V, --version
Print version
Download a windows build from the latest release.
Other platforms should compile with the instructions below (linux builds may be added in future)
To compile from source, install the rust tooling rustup, clone this project repo then use cargo run
to build and run the project.
texpresso is used to decode dxt data, and lzma-rs for lzma decompression.
To parse VTFX files correctly, we parse the header contents manually while performing big to little endian conversion (rust thankfully provides this for most major data types). Additionally, images using DXT compression also require data to be converted from big to little endian before being uncompressed. This is custom written for BC1 and BC3 data blocks.
Thankfully no endian conversion is required for LZMA compressed data but some data does need to be adjusted for decompression to work correctly with lzma-rs.