-
Notifications
You must be signed in to change notification settings - Fork 12
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
How to handle RGBE? #80
Comments
That depends. Assuming that RGBE means 8-bit RGB mantissas and 8-bit shared exponent (a.k.a. Radiance HDR), and that the goal is to get floating-point RGB values in the fragment shader, here's how such data could be treated at runtime. Option 1 Option 2 Option 3 On a semantic level, I think that using RGBE data with RGBA8_UNORM for |
@lexaknyazev the choice from the list you describe should not be dictated by the file format and probably not even by libktx or similar. It should be left to the application. All 3 are possible, though no. 2 depends on availability of those formats. The common thread is RGBA8_UNORM so I think that is what we should use in KTX2, along with the DFD describing the 4th component as an exponent. We could also add metadata for the latter. |
Using RGBA8_UNORM with a custom sample information in DFD will be error-prone because such approach requires loaders to read and understand both Adding to #75, I'd say that |
We'll use VK_FORMAT_UNDEFINED and the DFD. Should we support RGBD and RGBM as well? Or should we leave it to referers such as glTF IBL to specify how these 3 should be identified in a KTX2 file? I think it is better for the KTX2 spec. to describe this. |
The DFD should be somehow enhanced to properly support RGBD and/or RGBM. |
It will be. |
Remember to add an exception for these formats to the DFD color model recommendation in section 3.12. |
DFD 1.3 has support for RGBD, RGBE and RGBM (i.e common divisor, exponent and multiplier.) The way is does it, labelling and repeating the alpha channel sample, makes it difficult to use with block-compressed textures (bct) because some bct formats do not have explicit alpha channels, in the DFD anyway, even though they support alpha, e.g. ASTC. Is it useful to try to do RGBD, RGBE & RGBM with bct? Or should this use be limited to uncompressed formats, maybe even specifically to rgba unorm? Or should we drop the idea of supporting this in KTX2? |
Getting correctly filtered values of scaled (E/M/D) texels from block-compressed formats would involve 2-pass decoding that subverts the whole reason of using compressed formats. Moreover, these "scaling factors" need additional parameters, namely: RGBE RGBM and RGBD |
I'm not understanding this. How does 2-pass decoding subvert using compression whose purpose is to make the texture smaller?
The DFD supports common multipliers and divisors. See section 5.15. When you say "extra" do you mean something in addition to this? It sounds like your conclusion is to support RGB[DEM] only for uncompressed formats. Is that correct? |
The main property of block-compressed texture formats is that they stay compressed on the GPU while providing accurate filtering. Getting correctly filtered values from block-compressed RGBE/RGBM/RGBD (with scaling factor in Alpha) involves:
Uploading block-compressed data as-is and decoding final values in shaders (after filtering) will result in incorrect (severity depends on content) values.
Yes. In practice, RGBM is usually defined as
DFD should provide Same applies to RGBD. |
"Shortcut" part added in 92e9607. "Contradiction" part was already there. |
There's a use for RGBE textures. What VkFormat should we use: RGBA_UNORM, RGBA_SNORM or UNKNOWN? The DFD can identifiy that the 4th channel is an exponent in the same way that R9G9B9E5 is described. For VkFormat we should probably go with whatever format is best used to upload the data to Vulkan or OpenGL.
The text was updated successfully, but these errors were encountered: