Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KTX2 ecosystem requirements #1771

Open
6 of 14 tasks
donmccurdy opened this issue Feb 26, 2020 · 13 comments
Open
6 of 14 tasks

KTX2 ecosystem requirements #1771

donmccurdy opened this issue Feb 26, 2020 · 13 comments

Comments

@donmccurdy
Copy link
Contributor

donmccurdy commented Feb 26, 2020

This is a meta issue, tracking tasks required for KTX2 (and KHR_texture_basisu) to be considered production-ready. Related issues are grouped in the compressed textures milestone.

KTX2 material authoring:

  • Complete pipeline for producing glTF files with KTX2 embedded, given glTF files with PNG/JPG embedded.
    • gltfpack converts textures to ETC1S or UASTC
    • libktx will be a useful part of this pipeline, but doesn't do the full glTF->glTF conversion itself.
    • glTF-Transform converts textures to ETC1S or UASTC
    • glTF-Pipeline can roundtrip files using KTX, converting textures in progress.
  • Test pipeline against many glTF models, compare results in viewers (see below), and write up best practices if necessary.
  • (Optional) Direct export to glTF+KTX2 from DCC tools (Maya, Blender, 3DS Max, ...)

KTX2 material clients:

  • 2+ viewers/engines for testing glTF assets containing KTX2 material textures.
  • 1+ production-ready, lightweight transcoder.

IBL:

To be determined.

@donmccurdy donmccurdy added this to the Compressed Textures milestone Feb 26, 2020
@donmccurdy
Copy link
Contributor Author

I think next steps here might be:

  1. Come up with a (tentative) recommendation on KHR_materials_basisu and independent data channels #1682.
  2. Implement that recommendation in gltfpack and 2+ viewers/engines.
  3. Test extensively to confirm or improve solution to KHR_materials_basisu and independent data channels #1682.

@abwood
Copy link
Contributor

abwood commented Feb 27, 2020

For KTX2 Material Authoring, it would be useful to update VSCode glTF tools to provide a mechanism to convert png/jpg to KTX2. We would need encoding/decoding in web assembly for this to happen, but I'm not certain of the state of wasm ktx2 encoding/decoding.

@zeux
Copy link
Contributor

zeux commented Feb 27, 2020

Yeah I've been thinking about wasm ktx2 myself. gltfpack is now (optionally) distributed as an npm package: https://www.npmjs.com/package/gltfpack - but that version can't compress textures because the compressor is external. I'm not sure what the state of threading is in wasm right now though - the compressor is really slow on a single thread :(

@donmccurdy
Copy link
Contributor Author

I've heard WASM threading is working in Chrome, per https://twitter.com/prestomation/status/1218269561616683009. Don't know status beyond that. I'd love to be able to wrap gltfpack in a little web app — like https://squoosh.app/ but for glTF files. But certainly that's more of a nice-to-have for getting the KTX2 ecosystem ready for wider use. :)

@donmccurdy
Copy link
Contributor Author

[Just added some updates to the OP on this thread.]

@zeux
Copy link
Contributor

zeux commented Jul 29, 2020

FWIW gltfpack now has full support for this, including ETC1S and UASTC and is able to use either basisu or toktx executable to do the actual conversion (only toktx path supports zstd super compression for UASTC).

@lexaknyazev
Copy link
Member

Optimized low-level transcoders are public now. The collection currently includes ASTC, BC7, and RGBA32 targets for UASTC source data.

https:/KhronosGroup/Universal-Texture-Transcoders

@SaschaWillems
Copy link

Not sure if this is the correct spot to ask, but are there any KTX2 image viewers available?

@donmccurdy
Copy link
Contributor Author

@SaschaWillems we could use more in this category, but https://sandbox.babylonjs.com/ will preview KTX2 images well.

@abbaswasim
Copy link

@SaschaWillems Kram claim to support ktx and ktx2 with the following limitations:

KTX - only uncompressed, mip levels are unaligned to block size from 4 byte length at chunk 0 
  metadata/props aren't standardized or prevalent
  libkram supports only text props for display in kramv

KTX2 - works in kram and viewer, has aligned levels of mips when uncompressed, 
  libkram supports None/Zlib/Zstd supercompression for read/write
  libkram does not support UASTC or BasisLZ yet

@andreasplesch
Copy link
Contributor

Is it time to update the check list on the top ?
What is the most light weight solution to support KHR_texture_basisu, perhaps including sacrificing least common format combinations ?
ktx-parse seems light weight for parsing. Transcoding still seems heavy with large wasm files required. https:/KhronosGroup/Universal-Texture-Transcoders seems incomplete.
Would support for ktx2 containers with DDS style/GPU supported compression and no transcoding be considered useful, as a first step towards replacing dds which still seems popular ?
Is direct GPU/driver support for basisu compression on the horizon ? Or already considered outdated or out of scope for GPU support ?
Apologies for all the questions, but the ktx2/basis ecosystem is quite complex.

@donmccurdy
Copy link
Contributor Author

donmccurdy commented Oct 21, 2023

Originally this was written around the KTX2 launch. Perhaps this issue shouldn't be the permanent home for the list. Is KTX2-specific software wanted on https://github.khronos.org/glTF-Project-Explorer/, or on a KTX2 equivalent?

What is the most light weight solution to support KHR_texture_basisu ?

I think both the Basis Universal and KTX Software "MSC" transcoders are of similar weight, a couple hundred kilobytes gzipped. I do wish that KhronosGroup/Universal-Texture-Transcoders were more complete, for that reason. But I suspect it will require volunteers or resources to complete that.

Would support for ktx2 containers with DDS style/GPU supported compression and no transcoding be considered useful...

Personally I would consider it useful, yes. At least as a standalone capability – whether it belongs in an official glTF extension is probably a longer discussion. I believe the https:/KhronosGroup/KTX-Software maintainers have indicated interest in providing compression tools but don't have the time/resources to do it. It may (?) already be possible to pack the files if you have the compressed data already, or ktx-parse could do that (packing into KTX2, not GPU compression...) with a bit of scripting.

Is direct GPU/driver support for basisu compression on the horizon ?

I suspect that's not something the GPU itself can provide. Implementing it in drivers or browsers would be very interesting, though I haven't heard discussion of either at this point.

@alecazam
Copy link

alecazam commented Feb 22, 2024

kram can load and generate BC/ASTC/ETC2 textures stored in KTX, KTX2, and DDS files. There is a library that is all C++, and utils for quick load from mmap-ed archives. KTX would need compressed in the archive, and KTX2 can compress the mips and simply be archived.

I haven't seen any adoption of KTX2 by any of the IHVs or consoles. Lack of viewer support, Photoshop/Figma support, and encoders. I tried to address all of these, but the Photoshop viewer was too much work, and the API unchanged for 30 years.

kram has been in production use for 4 years now. PNG and DDS seems to be good enough for most tools. And consoles have to convert to platform-specific textures in the end that are pre-tiled. We never use basis, and the time to encode are too high. I was considering adding load of basis data for the kramv viewer. My work uses KTX, and we haven't moved to KTX2 yet.

Also unclear with sparse textures, how that fits into the KTX2 roadmap. Material indirection alleviates some of the need for sparse textures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants