Let’s talk about integrating more 3rd-party texture compression tools in CGE.
The goal is to
-
make some necessary tools for Auto-generated compressed and scaled textures | Creating Game Data | Castle Game Engine be available out-of-the-box in CGE, and in turn allow to use texture compression more easily in CGE.
-
This can also provoke progress in how you use these textures in CGE – right now you have to manually craft XML file
material_properties.xml
and then runcastle-engine auto-generate-textures
. If we will use this more, we can find better ways to configure it, maybe just visually design in CGE editor information about which textures are compressed and how.
@eugeneloza already did the important first step in Third party tools by eugeneloza · Pull Request #351 · castle-engine/castle-engine · GitHub (integrating ASTCENC), here I want to talk about integrating more tools.
NVIDIA:
Looking at it, it seems NVidia doesn’t really want version 3 to be open-source.
-
Debian packages version 2, Debian -- Details of package libnvtt2 in buster . It points to GitHub - castano/nvidia-texture-tools: Texture processing tools with support for Direct3D 10 and 11 formats. … with a note on GitHub “”“This repository has been archived by the owner. It is now read-only. “”” and a note in README “”“After more than 14 years maintaining and updating this library on my spare time, I’ve decided to officially discontinue it and focus my energy on other projects.”“”
So it seems that version 2 was properly open-source, but is unfortunately not maintained anymore.
Of note is that GitHub - castano/nvidia-texture-tools: Texture processing tools with support for Direct3D 10 and 11 formats. recommends some open-source alternatives, including Compressonator, but not NVTT 3.
-
Version 3, which I could download from NVIDIA Texture Tools 3 | NVIDIA Developer , has all the marks of a proprietary SDK. We have to register to download (binary version), and license is just a proprietary license “this is something owned by NVidia”. There are open-source tools around it: GitHub - nvpro-samples/nvtt_samples: NVIDIA Texture Tools samples for compression, image processing, and decompression. includes the actual “compress” program, using NVTT 3, but they just depend on NVTT 3 to do the actual work.
We don’t want to go into the legal maze of integrating with NVTT 3, esp. as we only need it to DXT*, and we can get it through other software too, including Compressonator.
Compressonator:
This tool seems “worth fighting for”, as it is properly open-source ( compressonator/license at master · GPUOpen-Tools/compressonator · GitHub , with core being just trivial license on compressonator/frameworklicense.txt at master · GPUOpen-Tools/compressonator · GitHub ). And it is even recommended by the nvtt2 README on GitHub. And it supports a lot of output encodings, including ASTC, ATC, DXT*, ETC, ETC2.
Sidenote: AMD seems to be doing a lot of cool open-source things these days, I have a number of tools from https://gpuopen.com/ already on TODO list to play with
As for size (as Eugene points in Third party tools by eugeneloza · Pull Request #351 · castle-engine/castle-engine · GitHub , is is 150 MB – maybe a bit too large for an optional tool in CGE):
The compressed release is 68 MB ( Releases · GPUOpen-Tools/compressonator · GitHub , Linux version) although it seems that there are parts/core that are smaller.
Looking into the unpacked fles,
compressonatorcli_linux_x86_64_4.2.5150$ du -hs *
4,0K compressonatorcli
8,5M compressonatorcli-bin
9,5M documents-unused # ok, this was obvious to remove
12M images-unused # ok, this was obvious to remove
8,0K license
33M pkglibs
104M qt
So most of the size is in the qt
subdirectory. Can we maybe avoid packaging some of these libs? I tried to just remove qt
but I see that binary then fail.
My suggested way forward (to @eugeneloza or anyone else that wants to help, speak up here):
-
Look into Compressonator more. Can we somehow take only a subset of it, reducing the size?
-
Look into other software mentioned on GitHub - castano/nvidia-texture-tools: Texture processing tools with support for Direct3D 10 and 11 formats. as “If you are looking for alternative texture compression tools and processing algorithms I recommend you check these out:” . As a basic requirement, we need a good-quality open-source compressor for DXT* (as the most popular and established GPU compression methods on desktops now).
And we can talk about it in this thread.
I do not reject the possibility of “just including Compressonator in CGE distribution”. We can do it, and live with extra +68 MB zip size, for a good open-source tool.