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

KHR_texture_float_bc6h: Compressed float format for material textures #1955

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

rsahlin
Copy link

@rsahlin rsahlin commented Mar 17, 2021

The purpose of this extension is to enable use of HDR material textures by means of compressed texture float format VK_FORMAT_BC6H_UFLOAT_BLOCK.
KTX v2 shall be used as a container, the extension is defined in a way that follows the paradigm of KHR_texture_basisu.
To decode textures this package can help:
https://github.com/KhronosGroup/BC6H-Decoder-WASM

The intended usecase for this extension is any usecase where HDR image resources needs to be specified, for instance in an environment map (IBL) but it could be relevant for any material texture where increased range is wanted.

The format VK_FORMAT_BC6H_UFLOAT_BLOCK is chosen based on previous discussions with input from, Alexey, Don, Norbert and others.

extensions/2.0/Khronos/KHR_texture_float_bc6h/README.md Outdated Show resolved Hide resolved
extensions/2.0/Khronos/KHR_texture_float_bc6h/README.md Outdated Show resolved Hide resolved
- Orientation metadata (`KTXorientation`) MUST be `rd` or omitted.
- Color space information in the DFD MUST match the expected usage, namely:
- For textures with **color data** (e.g., base color maps),
- `colorPrimaries` MUST be `KHR_DF_PRIMARIES_BT709`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For material textures, there's virtually no benefit in using high-precision textures with the standard (aka bt.709) gamut. Bringing WCG material texture support to glTF would require much more infrastructure updates than adding a new pixel format.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the BT709 standard supports a bitdepth of 8 or 10 - could you please explain why this would not be beneficial in our usecase?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because to get that benefit in rendering context, all these specific conditions should be met:

  • Original texture source data is authored with precision greater than 8-bit sRGB, so there is actual data in those extra bits.
    • Note that 8-bit sRGB has roughly 12 bits of linear precision for values near zero and about 7 bits of linear precision for values near one.
  • That extra precision is amplified enough during shading so that it makes a difference on a standard screen after the tone mapping.
    • A good example would be a simple linear gradient that is stretched over a very long object so that a single 1/255 step takes lots of screen space thus making that gradient look quantized.


## KTX v2 Images with VK_FORMAT_BC6H_UFLOAT_BLOCK

To cover usecases where a texture source shall have increased dynamic range
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Higher-fidelity material textures and non-prefiltered IBLs have different input data requirements and unlikely to be served by a single extension.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what is your suggestion?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were couple attempts at defining an IBL extension within the current ecosystem. My suggestion is to converge there. In parallel, we could work on WCG support in glTF. This is a big topic with major ecosystem implications, so it should start with a high-level discussion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure - I agree with that.
However, in the meantime I think we could make progress with either BC6H or RGB9E5 which are needed in order for us to define enviroment light extension.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the immediate goal of these extensions is to provide storage support for IBL, that's fine. Still, I wouldn't expect the finalized IBL extension to support more than one storage option.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the immediate goal of these extensions is to provide storage support for IBL, that's fine. Still, I wouldn't expect the finalized IBL extension to support more than one storage option.

Well, the goal is to provide support for float source images (textures) - one immediate usage of this would be the IBL.
Written the way it is it shall also be possible to use as a texture source for materials, ie the same way that KHR_texture_basisu is used.

extensions/2.0/Khronos/KHR_texture_float_bc6h/README.md Outdated Show resolved Hide resolved
@rsahlin rsahlin changed the title KHT_texture_float_bc6h: Float format for material textures KHT_texture_float_bc6h: Compressed float format for material textures Mar 17, 2021
When the extension is used, it's allowed to use value `image/ktx2` for the `mimeType` property of images that are referenced by the `source` property of `KHR_texture_float_bc6h` texture extension object.

At runtime, engines are expected to check hardware support for VK_FORMAT_BC6H_UFLOAT_BLOCK, if not present the extension is not supported.
This means that it is not allowed to transcode the texture data to some other format.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glTF does not prescribe runtime behaviour so this statement cannot be included. If there's an application-specific use-case, this should be a vendor extension.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed wording and added conformance section.

@rsahlin rsahlin changed the title KHT_texture_float_bc6h: Compressed float format for material textures KHR_texture_float_bc6h: Compressed float format for material textures Apr 10, 2021
@rsahlin rsahlin mentioned this pull request Apr 29, 2021
@fire
Copy link

fire commented Jul 16, 2021

Is there are corresponding uncompressed float format? Something like tinyexr compiled to wasm? Feel free to direct me to another location.

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

Successfully merging this pull request may close these issues.

3 participants