KTX2Loader: Support RGBA 16-bit unsigned normalized formats#33245
Open
donmccurdy wants to merge 1 commit intomrdoob:devfrom
Open
KTX2Loader: Support RGBA 16-bit unsigned normalized formats#33245donmccurdy wants to merge 1 commit intomrdoob:devfrom
donmccurdy wants to merge 1 commit intomrdoob:devfrom
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Mugen87
reviewed
Mar 26, 2026
| if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F; | ||
| if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F; | ||
| if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8; | ||
| if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = extensions.get( 'EXT_texture_norm16' ).RGBA16_EXT; |
Collaborator
There was a problem hiding this comment.
Do you mind adding this line in below module, too?
three.js/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js
Lines 271 to 272 in a14d874
In this way, the WebGL 2 backend of WebGPURenderer support this feature as well.
The WebGPU backend should already cover this use case here:
three.js/src/renderers/webgpu/utils/WebGPUTextureUtils.js
Lines 1360 to 1362 in a14d874
Edit: RGBA16Uint is obviously the wrong format. Alternative suggestion: #33250 (comment)
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for KTX2 files containing
vkFormat = VK_FORMAT_R16G16B16A16_UNORM. Support for R, RG, RGB, and equivalent SNORM types is left open for PRs, as I don't have textures in these formats yet. The texture included here was produced with OpenImageIO and KTX-Software:Related: