Texture Pack Specification for all Emulators (KTX2 Format)

Hi everyone,

I am currently thinking if it makes sense to create some kind of specification for texture packs. Texture packs become more and more relevant for the emulator scene. PS1, PS2, PSP, N64, GameCube, Wii, DS, 3DS, Saturn, Dreamcast, Xbox etc. are all consoles which are using texture packs to improve the quality of games.

However the emulator scene is very fragmented concerning texture packs.

  • Nintendo64 with the plugin GlideN64 uses the formats HTS and PNG.
  • PS1 with duckstation uses DDS and PNG.
  • PS2 with PCSX2 uses DDS and PNG.
  • GameCube/Wii with Dolphin uses DDS and PNG.
  • PSP with PPSSPP uses BASIS and PNG
  • Dreamcast with Flycast uses DDS and PNG
  • Nintendo3DS with Citra/Azahar uses PNG
  • etc.

What is equal on all emulators is PNG, because of the texture dumping. Each emulator dumps the texture in PNG. So editing the textures in this format is easy and user friendly. However distributing high-resolution textures becomes a challenge.

  • Texture packs have a big size.
  • On mobiles it cannot be used due to the large size.
  • Sometimes the transcoding creates stutters
  • DDS formats are outdated
  • Converting DDS back to PNG is difficult and lossy.
  • Tools are always different.

Actually the same happened with GPU compression formats and this is why Khronos developed the KTX2 format. So my idea was to create a specification to cover the dumping, converting, distribution and editing of the High Res Texture Files based on the KTX2 format.

KTX2 files are a texture container like DDS. A KTX2 file contains several versions of the texture (uncompressed, compressed, normal map, occlusion map) and is future proof. In addition the loading times of those textures are much faster, because it is already transcoded on the fly on most GPUs (mobile, pc, embedded system). Moreover if emulation gets more advanced the KTX2 file can also contain normal maps, occlusion maps etc. So the management of High-Res Texture Files becomes easier.

The Idea is, to keep the dumping in a png format, but to distribute the High Res Texture Packs as KTX2 files, compressed in a Zstandard File. The creator of the pack can disctribute the KTX2 files in various versions:

  • Full-Size (contains KTX2 files in PNG in _BLOCK uncompressed format)
  • Fast-Loading (contains KTX2 files in ETC1S format)
  • High-Quality (contains KTX2 files in UASTC format)

https://docs.vulkan.org/samples/latest/samples/performance/texture_compression_basisu/README.html

The KTX2 files are then clustered in a zstandard file due to real time access. So the user has to handle only one zstandard file which contains various high-res textures in KTX2 format.

The benefit would be for texture creators and developers. Libraries can be created, tools to edit KTX2 files (export, edit and import textures) can be created, the tools stay the same for all consoles/emulators.

Compare it with the CHD format for compressing isos or disc images. A standard which everyone can use and which should simplify everything.

I think png is similar in size or sometimes even smaller than KTX2, the main advantage of which is that it stays compressed on the GPU to take up drastically less VRAM and having faster loading times as a result. I think there are some instances where texture pack performance can be a problem, and KTX2 could potentially help with that, but I don’t know that it would help with any of the other problems as compared with just putting pngs in a standardized compression/container.

This is not an area where I have a lot of technical expertise, though, so I’d be happy to be wrong.

1 Like

Actually it depends concerning the size. KTX2 is just a container for a texture. Means you can place several image files within a KTX2. For instance The uncompressed PNG as _Block. But you can also insert the compressed image, a midmap, a normal map etc. So everything is at one place.

This is why it depends concerning the size. If you compress a PNG you can decide if you wanna have a high quality texture (which is somehow the size of an png) or you can choose lowest size (which is less in size than a PNG)

KTX2 is pretty flexible and the goal was to have an easily manageable container which uses less space and is compatible with almost all devices. Especially for mobile devices like android it is a big plus. Instead of having a texture pack of 2GB it has only 800MB.

I forgot to mention what you said. Yes, the VRAM usage is much less than with PNG or with DDS. So you can shrink the texture pack size and the VRAM usage in addition to a better texture file management.

But I wanted to hear different opinions about that. This is why I wrote the topic here, because libretro brings a lot of great developers together.

1 Like