Engine Tools/TexCooker
TexCooker is a batch texture conversion utility that is designed to convert source uncompressed texture files (mainly in TGA format) to the game default DDS (Direct Draw Surface) files with GPU-efficient compression.
Configuration
Each configuration may define one or more compression methods suitable for your needs.
You can specify an external utility that will perform conversion of textures and also many different usages that will change texture parameters.
BatchConfig
{
arguments "%ARGS%";
source_materials "GameData/materialsSRC/";
source_image_ext ".tga";
compression "DXT" {
// compression utility path
application "Tools/TexConv/texconv.exe";
arguments "-sepalpha -at 0 -y -dx9 \"%INPUT_FILENAME%\" -o \"%OUTPUT_FILEPATH%\"";
usage diffuse {
arguments "-f dxt1";
}
usage diffuse_nomip {
arguments "-f dxt1 -m 1";
}
usage diffuse_alpha {
arguments "-f dxt5";
}
}
}
Targets {
"PC" {
compression "DXT";
output "GameData/materials";
}
}
In this example:
- source_materials specifies our folder where to take our raw textures
- Compression "DXT" is a compression method with specified texconv.exe as converter
- Three usages diffuse, diffuse_nomip, diffuse_alpha
- Each section has it's own set of arguments for the converter
- Target named "PC" that will use "DXT" compression method and output folder
Source textures
In order to use it you'll need to make a folder named materialsSRC; It is basically the same as the regular materials folder.
materialsSRC consists of:
- TGA textures
- Material files
When TexCooker is working, it walks through all MAT files in the materialsSRC folder looking up for the usages.
Material files are pretty much the same but with a little addition:
"Base"
{
BaseTexture "grass/grass_lawn" usage:diffuse;
surfaceprops "grass";
};
Take a look at usage:diffuse. In this example:
- usage: is used to pick BaseTexture key as actual source texture path
- diffuse is texture usage that was defined in TextureCooker config file
Running TexCooker
Run it using following command
Bin64\texcooker.exe -target PC
pause
It will convert every texture to the target format, will put them into output folder and also will copy all material files.
- If you have changed one or more textures, you can re-run this command. only changed textures will be re-converted.
- If you changed entire usage configuration, it will re-convert all textures using this usage.