# How to inject \`@babylonjs/ktx2decoder\` into Babylon?

**URL:** <https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160>\
**Category:** Questions\
**Tags:** ktx2\
**Created:** [January 20, 2026, 6:56am UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160 "2026-01-20T06:56:33Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 2:26pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/21 "2026-01-30T14:26:46Z")

</div>

Sorry again for the inconvenience

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 4:45pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/22 "2026-01-30T16:45:36Z")

</div>

@regna @SondreElgBB and @AdmiralPotato it would be amazing if you could share one of the broken file even in PM so that I can do the best fix ?

---

<div class="post-metadata">

**Author:** ![regna](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/regna/32/23915_2.png) [@regna](https://forum.babylonjs.com/u/regna)\
**Post date:** [January 30, 2026, 5:16pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/23 "2026-01-30T17:16:37Z")

</div>

Sure, @sebavan! The only broken file I’ve seen is from @AdmiralPotato at the link:

> [@AdmiralPotato](#):
>
> [https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/football\_field\_ktx2.glb](https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/football_field_ktx2.glb)

* * *

Strangely, when I use `gltfpack`to do the KTX compression, there seems to be no issues. I’ve attached the files at the [Github link](https://github.com/regnaio/assets/tree/main/test):

- `football_field_raw.glb`(from AdmiralPotato - no KTX compression - works fine)

- `football_field_ktx2.glb`(from AdmiralPotato - with KTX compression - has issues)

- `football_field_raw2.glb`(`gltfpack`used on 1st file - with KTX compression - works fine)

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 5:32pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/24 "2026-01-30T17:32:43Z")

</div>

Thanks a ton I have all I need to work on a fix. I ll do it ASAP.

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 5:32pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/25 "2026-01-30T17:32:51Z")

</div>



---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 6:07pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/26 "2026-01-30T18:07:16Z")

</div>

Something that seems like it will continue being a problem here, is that the Babylon CDN version of the KTX2 decoder and other tools seems to be a uniform version that’s used across all versions of Babylon and the Sandbox.

> [https://cdn.babylonjs.com/babylon.ktx2Decoder.js](https://cdn.babylonjs.com/babylon.ktx2Decoder.js)

In order to prevent issues like this in the future, perhaps the version of the KTX2 decoder and all other CDN based dependencies that are used for a specific release of Babylon can be pinned to the Babylon version? Then if a future version of the decoder breaks, older versions of Babylon projects stay working exactly the same, especially since particular projects may either depend on, or have code that’s specifically countering bugs in that version of the decoder?

> [https://cdn.babylonjs.com/8.34.0/babylon.ktx2Decoder.js](https://cdn.babylonjs.com/8.34.0/babylon.ktx2Decoder.js)  
> [https://cdn.babylonjs.com/1.2.3.whatever-is-availabe-when-babylon-8.34.0-was-released/havoc.js](https://cdn.babylonjs.com/1.2.3.whatever-is-availabe-when-babylon-8.34.0-was-released/havoc.js)  
> [https://cdn.babylonjs.com/1.2.3.whatever-is-availabe-when-babylon-8.34.0-was-released/havoc.wasm](https://cdn.babylonjs.com/1.2.3.whatever-is-availabe-when-babylon-8.34.0-was-released/havoc.wasm)

So Babylon 8.34.0 would only request that version of the decoder, and then projects depending on that version will remain stable as new versions are released.

What do you guys think of this idea?

---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 7:06pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/27 "2026-01-30T19:06:04Z")

</div>

I have more info and a more precise reproduction. It seems to be the KTX2 UASTC compression option that’s breaking specifically.

I used this tool to create the results: [glTF Compressor](https://github.khronos.org/glTF-Compressor-Release/)

Working, no compression:

 ![sandbox.babylonjs.com_ (1)](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/b/fb13a8a7ba5d9273bcfd8a028ef77e8cf9b042ab.jpeg)

> [https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne\_with\_grid\_uv.glb](https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne_with_grid_uv.glb)

Working, ETC1S:

 ![sandbox.babylonjs.com_ (2)](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/9/c/9cde6689c2eb07fbbb5d2c45d960ee66ad5fa15b.jpeg)

> [https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne\_with\_grid\_uv-ktx2-etc1s.glb](https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne_with_grid_uv-ktx2-etc1s.glb)

Broken, UASTC:

 ![sandbox.babylonjs.com_ (4)](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/0/2/02f12de7f61a2e51372c1ad85ad67a0d20fcd370.jpeg)

> [https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne\_with\_grid\_uv-ktx2-uastc.glb](https://aroundar.sfo3.cdn.digitaloceanspaces.com/public/suzanne_with_grid_uv-ktx2-uastc.glb)

Edit: Also, weirdly, when I drag in the broken one to the sandbox, the Inspector pops up, but not for the others?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 7:29pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/28 "2026-01-30T19:29:37Z")

</div>

Fix is in and will be deployed in a couple hours. I ll ping you all back here to test 🙂

Thanks again and sorry to have broken it in the first place 🙂

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 8:31pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/29 "2026-01-30T20:31:01Z")

</div>



---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 8:31pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/30 "2026-01-30T20:31:20Z")

</div>

Fix should be there

---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 8:57pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/31 "2026-01-30T20:57:17Z")

</div>

@sebavan I just tried the sandbox with with my latest Suzanne files and the football field, in an incognito window to make sure nothing was cached. Still no luck with the UASTC compression approach, which seems to be where the problem is.

The broken Suzanne is the most obvious tell in the examples I posted most recently: [How to inject `@babylonjs/ktx2decoder` into Babylon? - #27 by AdmiralPotato](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/27)

Is there anything more I can do to help?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 9:14pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/32 "2026-01-30T21:14:35Z")

</div>

Can you check that the sandbox is well on 8.49.4 ?

---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 9:18pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/33 "2026-01-30T21:18:55Z")

</div>

Well, this is wild. I have a co-worker who’s on the east coast, and it’s working for him. Perhaps this is a CDN caching issue? I’m in SLC, and getting different results that he is.

…and now 5 minutes later it’s working for me now. It looks like it was a CDN caching delay.

I suppose this makes me want to bring up the idea of [version pinned CDN links](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/26) again. Might that be something that can be investigated in the near future?

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 9:20pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/34 "2026-01-30T21:20:12Z")

</div>

You can already with [Babylon.js Sandbox - View glTF, glb, obj and babylon files](https://sandbox.babylonjs.com/?version=8.42.0) for instance

---

<div class="post-metadata">

**Author:** ![sebavan](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/sebavan/32/57_2.png) [@sebavan](https://forum.babylonjs.com/u/sebavan)\
**Post date:** [January 30, 2026, 9:20pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/35 "2026-01-30T21:20:54Z")

</div>

About suzanne head it did not work before so it is not a regression let me add @Evgeni_Popov to see if something is doable.

---

<div class="post-metadata">

**Author:** ![Will\_FrameVR](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/will_framevr/32/48897_2.png) [@Will\_FrameVR](https://forum.babylonjs.com/u/Will_FrameVR)\
**Post date:** [January 30, 2026, 9:28pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/36 "2026-01-30T21:28:43Z")

</div>

yeah that ArrayBufferLike TS change was an annoyance for us, too.

If anyone has questions about self-hosting the babylon CDN - ask away! We’ve got a nice process baked into our deploy pipelines that fetches the version-matched CDN build and deploys it to a cloudfront distribution.

---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 9:32pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/37 "2026-01-30T21:32:34Z")

</div>

@Will_FrameVR Honestly? That would be awesome. It makes me think that this process should be its own forum post, or even better… added the the Babylon Documentation? I wish I’d had a documented process for this last year when I had to figure out hosting the decoder WASMs myself because we had a vendor that needed SharedArrayBuffers and all WASMs needed to be hosted on our domain before any of them would start working again.

---

<div class="post-metadata">

**Author:** ![AdmiralPotato](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/admiralpotato/32/49757_2.png) [@AdmiralPotato](https://forum.babylonjs.com/u/AdmiralPotato)\
**Post date:** [January 30, 2026, 9:39pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/38 "2026-01-30T21:39:32Z")

</div>

Sorry to hijack your whole thread @regna. I guess that when your change was deployed, it just also happened to deploy some unrelated regression issues at the same time, if I’m understanding all of this correctly?

---

<div class="post-metadata">

**Author:** ![regna](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/regna/32/23915_2.png) [@regna](https://forum.babylonjs.com/u/regna)\
**Post date:** [January 31, 2026, 1:16am UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/39 "2026-01-31T01:16:17Z")

</div>

No worries, @AdmiralPotato , I’m glad all is good now thanks to @sebavan!

---

<div class="post-metadata">

**Author:** ![Evgeni\_Popov](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/evgeni_popov/32/4432_2.png) [@Evgeni\_Popov](https://forum.babylonjs.com/u/Evgeni_Popov)\
**Post date:** [February 2, 2026, 12:38pm UTC](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160/40 "2026-02-02T12:38:52Z")

</div>

> [@sebavan](#):
>
> About suzanne head it did not work before so it is not a regression let me add @Evgeni_Popov to see if something is doable.

It must be a problem with the file, because it doesn’t work in [3js viewer](https://gltf-viewer.donmccurdy.com/) either:

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/c/b/cb87c6804b157b5e5b7817b7f08869611577e348.png)

I unpacked the glb file and tried to display the .ktx2 file. It was blank in the sandbox. I also tried with two online .ktx2 viewers, but both generated an error.

[Previous page](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160.md?page=1)

[Next page](https://forum.babylonjs.com/t/how-to-inject-babylonjs-ktx2decoder-into-babylon/62160.md?page=3)
