KTX - michaliskambi/x3d-tests GitHub Wiki

The point of the proposal is to add KTX (Khronos Texture Format) as a recommended format to be supported by X3D browsers.

Why

KTX is a Khronos standard, and it's really good for providing textures for modern rendering libraries (OpenGL, Direct3D, Vulkan...).

Features supported by both DDS and KTX:

  • Supports GPU texture compression (S3TC, PVRTVC...). Note that there are various GPU compression algorithms (S3TC aka DXT*, PVRTC*, ATITC*, ETC*). Content creators using KTX or DDS with GPU texture compression must be aware that not all compression formats are available on all platforms, so it is wise to always provide an uncompressed texture version as an alternative to the compressed one, to work on all platforms.
  • Supports 2D textures, 3D textures, cubemaps (6x 2D texture)
  • Supports mipmaps (that is, mipmap information can be stored directly in the texture file; this usually results in better quality mipmaps than when you generate mipmaps at runtime)
  • Texture arrays (something more flexible than 3D texture, since the number of slices doesn't have to be power of two)

Features only in KTX:

  • 1D textures (useful e.g. to provide precalculated values of some function to shaders; e.g. the results of "sin(x)" could be expressed as a grayscale texture of size 1x256, and thus an approximate "sin(x)" can be implemented by a simple texture lookup (with some trivial mapping applied to adjust the input and output domain))
  • KTX may be top-to-bottom or bottom-to-top. Thus, it is friendly to both Direct3D (that expects top-to-bottom data) and OpenGL (that expects bottom-to-top). In contrast, DDS only supports top-to-bottom, which means that you need to do tricks to make it supported in OpenGL (in case of CGE: when reading DDS, we invert on CPU non-compressed textures, and we expect the compressed textures to be already inverted; IOW, in each case, we effectively invert them twice in the pipeline PNG -> DDS -> CGE).
  • KTX is a proper standard, with open specification developed by a coordination of various people at Khronos. In contrast, DDS "specification" is "whatever Microsoft is doing" ( https://en.wikipedia.org/wiki/DirectDraw_Surface , X3D bibliography http://www.web3d.org/documents/specifications/19775-1/V3.3/index.html just links to https://docs.microsoft.com/pl-pl/windows/desktop/direct3ddds/dx-graphics-dds-reference ).

KTX information

Castle Game Engine documentation for DDS and KTX (contains various CGE implementation details, but also general info about KTX):

Viewers:

glTF relation

KTX in glTF?

License