Skip to content

Conversation

donmccurdy
Copy link
Collaborator

Related issues:

Description

Adds support to KTX2Loader for textures using the R11G11B10 format. Colors in the KTX2 sample are slightly different (#4dae4b vs. #4eaf4a) but this is expected as the format has less precision in the 0–1 range: https://bartwronski.com/2017/04/02/small-float-formats-r11g11b10f-precision/.

To create the sample included in this PR, I used KTX Software:

ktx create --format B10G11R11_UFLOAT_PACK32 --assign-oetf linear --assign-primaries bt709 --generate-mipmap source/r11g11b10.exr ktx2/2d_r11g11b10_linear.ktx2

See: donmccurdy/KTX2-Samples@6248251

Copy link

github-actions bot commented Aug 9, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 338.74
79.06
338.9
79.1
+163 B
+43 B
WebGPU 568.78
157.23
568.98
157.28
+197 B
+44 B
WebGPU Nodes 567.39
156.99
567.59
157.03
+197 B
+42 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 470.52
113.83
470.64
113.87
+124 B
+41 B
WebGPU 642.52
173.77
642.68
173.81
+158 B
+42 B
WebGPU Nodes 597.17
163.07
597.33
163.09
+158 B
+21 B

@donmccurdy
Copy link
Collaborator Author

donmccurdy commented Aug 9, 2025

Note - I've included the same changes in WebGPURenderer, because it looked easy enough to allow. But I get (unrelated) errors when trying to swap in WebGPURenderer on this KTX2 example, so I haven't confirmed whether R11G11B10 works for WebGPURenderer or not.

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 10, 2025

We can still merge the PR and then check the errors with the WebGPU backend.

@Mugen87 Mugen87 added this to the r180 milestone Aug 10, 2025
@Mugen87 Mugen87 merged commit 75b9d90 into mrdoob:dev Aug 10, 2025
9 checks passed
@donmccurdy donmccurdy deleted the feat/ktx2loader-r11g11b10 branch August 10, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants