KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
860 stars 223 forks source link

Recommended workflow for KTX/KTX2 files #338

Open alecazam opened 3 years ago

alecazam commented 3 years ago

I'm using KTX as a source and destination format for HDR and encoded textures, but do image editors like Photoshop have a plugin to export/edit these files? They seem to solely be relegated to a destination format without this kind of support.

There also don't seem to be any pixel editors that can work on mipmaps or HDR, and then save it back to KTX/KTX2. Also Windows thumbnail viewers seem to stop at PNG and DDS. ETC/PVRTC thumbnails on macOS aren't supported due to lack of a decoder. There aren't even any preview utilities for KTX2, and on macOS only ATSC is decoded, and BC is viewable in Preview. PVRTexToolGUI can open mips, but still can't display correct sRGB content, and displays block artifacts on anything larger than ASTC4x4 block sizes.

There just needs to be a little more tooling around KTX and KTX2 to help with all this workflow.

MarkCallow commented 3 years ago

We all agree that more tooling is needed. Photoshop has an API for image i/o as do the Autodesk products. If there were plugins providing these APIs then you could use the full power of the tools on KTX files. Similarly a Gimp plugin is seen as useful. One member has also recommended we add support to OpenImageIO (Homepage), (GitHub) which is used by professional tools. There has been some discussion in Khronos about funding efforts to jump start some of these things. I'm not sure there is much we can do about OS thumbnail previews though.

Take a look at the KTX wiki for a list of the currently known tools.

I was going to suggest for PVRTexToolGUI that you file bugs on the PowerVR forum. but I see you've already done that and I also see that they haven't exactly been responsive. I will talk to someone I know at Imagination.

donmccurdy commented 3 years ago

There aren't even any preview utilities for KTX2

The BabylonJS sandbox (https://sandbox.babylonjs.com/) seems to do a good job of previewing 2D KTX2 files, within some constraints. I expect it is limited to Basis Universal texture formats, encoded in WebGL-compatible dimensions.

alecazam commented 3 years ago

I finished a viewer for KTX/KTX2 textures. https://github.com/alecazam/kram It's not using libktx, but can display zstd compressed KTX2, just not Basis textures yet. I'll get there once I have the transcoder hooked up, or I add in libktx.

MarkCallow commented 3 years ago

@alecazam please add kram to the list of viewers in the KTX-Software wiki.

alecazam commented 3 years ago

Added. I used Github Actions to generate some binary releases of kram for Win/macOS so that should make it easier to try out and use. It's also a universal build for M1.

chriku commented 2 years ago

Similarly a Gimp plugin is seen as useful

I made a small proof of concept here: https://github.com/chriku/gimp-ktx As libktx can already convert from compressed formats the import is mostly selecting the right gimp/babl format. Same goes for the export, I just don't have any clue how to work the libktx compression functions

MarkCallow commented 2 years ago

Thank you for doing this. I wish you luck with progressing this.

When you wrote "As libktx can already convert from compressed formats" I was worried as there are many compressed formats that libktx cannot decompress. But I looked at your code and see that you are referring only to transcode of the BasisU formats. So no problem.

You need to very clear to your users that importing a BasisU compressed file and re-exporting the image as BasisU or ASTC will degrade the quality and should be avoided.

I also noticed a test for baseDepth=1 with an error saying invalid depth. You really need to say unsupported depth as deoth > 1 is valid for KTX and GPU APIs.

atteneder commented 2 years ago

Corresponding OpenImageIO feature issue