-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
KHR_texture_ktx #1964
base: main
Are you sure you want to change the base?
KHR_texture_ktx #1964
Conversation
2 texture formats VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 and VK_FORMAT_B10G11R11_UFLOAT_PACK32 are added. An implementation notes section is added. Supercompression scheme is added to ktx header field.
Given how glTF handles existing PNG/JPEG/Basis textures, this extension could only be used with non-color texture slots (e.g. normals or ORM) for the following reason. None of the proposed pixel formats support sRGB transfer because they already have high enough precision. Yet, all texture slots that use color data are currently locked to 8-bit sRGB inputs. Down-sampling data at runtime would subvert the whole reason of having it stored in high precision. If the goal of this extension is to allow any existing texture slot to support high-precision inputs, the extension spec should redefine that explicitly by stating that in those cases a linear transfer function is used. However the extension still cannot go beyond |
Right - we have a spec that declares sRGB transfer function for What if:
|
Add section 'Color Texture Source' to define that when this extension is used sRGB transfer function for color textures shall not be used. Update overview to include that this extension does not define HDR -> output mapping.
Change wording in Color Texture Sources section according to review comments, update contributors.
Updated according to review comments for completeness
Supercompression scheme must be 3 (ZLIB) Add requirement for colorprimaries and transfer function Specify ktx v2 imagte must be type 2D when used for material textures.
Add Zstandard supercompression Remove supercompression from cut'n pasted text under "Using KTX v2 Images...."
Update with more texture formats and description of intended usage of KTX file with multiple layers as an alternative to JPEG/PNG
Updated reqiurement for color texture sources according to review comment. Must be sRGB in case of 8 bits per pixel. May be linear encoded format VK_FORMAT_R16G16B16_UNORM or VK_FORMAT_R16G16B16A16_UNORM
Thanks for this draft, The list of supported Imagine upcoming demand to broaden the KTX2 support even further (e.g. to compressed formats like ASTC):
Regards, |
Thanks for your comment @atteneder Yes, the formats are choses as either:
I am not sure how to handle (directly) compressed formats such as ASTC - instead of using these the intention is to use KHR_texture_basisu - which can then be transcoded to ASTC on the target device. So, in conclusion - I see this extension as just providing uncompressed texture formats that are universally available (or super simple to convert to/from) Hope this answers your question? |
The only reason is that ASTC supports many more configurations and block sizes than the ASTC subset used for Basis Universal. Still, ASTC should not be included in this extension because emulating it on devices without hardware support is far from simple - the format is very complex. |
Indeed, thanks a lot! Admitted, the KHR_texture_astc example does not make much sense in the presence of BasisU. But even if I cannot come up with some sane example/use-case right now, I guess one extension per KTX2 format subset is the direction this is taking. |
Ah, ok I see thanks for the explanation @lexaknyazev |
@atteneder Please feel free to chime in on what VK_ formats that should be included in this extension. |
I do see that this PR has |
@aaronfranke this PR doesn't overlap with the features of But I think the OP is correct that it makes sense to continue with this extension only in conjunction with adding features to glTF, like IBL, that require some of these formats. And fully specifying an IBL extension is non-trivial. |
A use case I have for this extension is large-ish texture atlases using texture arrays, i.e., using a 2D array KTX2 file and the What's nice about how the extension is made is that it still allows a fallback to 2D images if the importer doesn't support KTX2 files or texture arrays, and how there isn't anything else to be specified to make interaction with e.g. I feel like expanding the pixel format or texture format support should be a responsibility of some other extension, not this one, and I'm fine with it restricting the allowed pixel formats to a subset compatible with PNG/JPEG by default. Same for disallowing e.g. cube map KTX files. I think just even allowing non-Basis (array) KTX2 files to be used warrants existence of this extension, and the extras could be tangential |
Development of this PR is halted until #1956 is finialized.
This extension started out as needed by KHR_lights_environment but the functionality is now moved into that extension
The purpose of this PR is to add support for textures using KTX v2 images, the intention is not to provide support for already supported formats such as the typical 8 bpp formats suppoted by JPEG or PNG, but rather to add support for formats that have increased precision and/or range.
However, the 'usual suspects' are included as means to strengthen KTX as an image container choice (over PNG/JPG).
You may see these as a means to 'cover all bases' in the glTF/KTX ecosystem as currently the only supported format is basisu supercompression.
This extension shall be seen as a building block for future extensions that will require HDR image support - for instance #1956
A similar extension aims at introducing HDR support using compressed textures : #1955
I am working on a CLI tool that can read .HDR (RGBE format) images and save out as rgb float format using KTX v2.
Currently very experimental and only has limited support for reading .HDR and saving in 32 bit float format.
Tool can also be used to pass a number of images as faces or layers, for instance when generating a cubemap.
Equirectangular images can be saved out as cubemap.