# Errors when trying to load draco compressed mesh

**URL:** https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665
**Category:** Bugs
**Created:** [December 23, 2023, 9:09am UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665 "2023-12-23T09:09:15Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![thomas](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomas/32/29205_2.png) [@thomas](https://forum.babylonjs.com/u/thomas)
#### Post date: [December 23, 2023, 9:09am UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/1 "2023-12-23T09:09:16Z")

</div>

I draco-compressed a mesh using [gltf-transform](https://gltf-transform.dev/cli) and now I’m getting errors thrown when I try to import it to my scene (uncompressed version works):

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/8/a/8aee061dc24fed31a47c506a89b9ac2bdf820ee1.png)

and here’s that unnamed function (not really sure what this file is):

 ![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/3X/f/1/f1039f65a6b084e32d537cdcd8ac4be0135a3ead.png)

Oddly enough, this GLB works in the sandbox and the playground: [https://playground.babylonjs.com/#XTNXFT#6](https://playground.babylonjs.com/#XTNXFT#6)

And here’s the compressed GLB: [boxcar/assets/models/treeOpt.glb at main · ThomasBurgess2000/boxcar · GitHub](https://github.com/ThomasBurgess2000/boxcar/blob/main/assets/models/treeOpt.glb)

The fact that it works in the playground makes me think there is some sort of draco decoding module that I’m missing locally, but I’m not sure what it is.

---

<div class="post-metadata">

### Author: ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)
#### Post date: [December 23, 2023, 12:53pm UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/2 "2023-12-23T12:53:37Z")

</div>

I believe something is missing from your imports.

---

<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: [December 23, 2023, 8:39pm UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/3 "2023-12-23T20:39:18Z")

</div>

This post should help you:

> [@Unable to import meshes, require extension KHR\_draco\_mesh\_compression is not available](https://forum.babylonjs.com/t/unable-to-import-meshes-require-extension-khr-draco-mesh-compression-is-not-available/13524/6):
>
> Hi, I added import '@babylonjs/loaders/glTF/2.0/Extensions/KHR\_draco\_mesh\_compression'; and it seems to be working! Thanks a lot for the help!

---

<div class="post-metadata">

### Author: ![thomas](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/thomas/32/29205_2.png) [@thomas](https://forum.babylonjs.com/u/thomas)
#### Post date: [December 24, 2023, 8:49am UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/4 "2023-12-24T08:49:21Z")

</div>

Hmm, unfortunately adding

```auto
import '@babylonjs/loaders/glTF/2.0/Extensions/KHR_draco_mesh_compression';

```

to the top of my file did not work.

The error that post is discussing is also different than the one I am getting, I believe my code does have access to the extension already.

---

<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: [December 24, 2023, 11:27am UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/5 "2023-12-24T11:27:34Z")

</div>

Indeed, it’s not the same problem. The function linked above is:

> <https://github.com/BabylonJS/Babylon.js/blob/master/packages/dev/core/src/Meshes/Compression/dracoCompression.ts#L62-L68>

It is named `decodeMesh`, I don’t understand why there’s no name in your screenshot…

Could it be a bug of the packager you use? Are you able to setup a repro somewhere?

---

<div class="post-metadata">

### Author: ![AleMuzzi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alemuzzi/32/37550_2.png) [@AleMuzzi](https://forum.babylonjs.com/u/AleMuzzi)
#### Post date: [January 30, 2024, 12:30pm UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/6 "2024-01-30T12:30:45Z")

</div>

Hey, I have the same problem too. Have you been able to find a solution? I managed to load the file with LoadFile() from @babylonjs/core, but then trying to decode the Draco mesh I got “Not a Draco file.” even thought the file is indeed a draco-compressed glb mesh and it loads ok in the playground. I’m supposing the issue here might be with the extension. As you do, I retrieve the meshes from the network and then I create a url for the blob, on which I cannot specify any extension. Providing the loader manually with the same file but with an extension, actually works. Any thought?  
Here some more details on the options I’ve tried [compression - Error while loading Draco-compressed mesh (glTF-Transform) in BabylonJS - Stack Overflow](https://stackoverflow.com/questions/77911999/error-while-loading-draco-compressed-mesh-gltf-transform-in-babylonjs)

---

<div class="post-metadata">

### Author: ![labris](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/labris/32/12576_2.png) [@labris](https://forum.babylonjs.com/u/labris)
#### Post date: [February 11, 2024, 3:56pm UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/7 "2024-02-11T15:56:40Z")

</div>

Here is the PG example with Draco mesh loading from blob - [https://playground.babylonjs.com/#FIWM5X#45](https://playground.babylonjs.com/#FIWM5X#45)

---

<div class="post-metadata">

### Author: ![AleMuzzi](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/alemuzzi/32/37550_2.png) [@AleMuzzi](https://forum.babylonjs.com/u/AleMuzzi)
#### Post date: [February 15, 2024, 8:38am UTC](https://forum.babylonjs.com/t/errors-when-trying-to-load-draco-compressed-mesh/46665/8 "2024-02-15T08:38:26Z")

</div>

After debugging BabylonJS’ core I discovered that using “.glb” was right and it was using the correct loader (_glTFLoader_ ), but there was a version mismatch in babylon’s imports causing a function not to be found, namely, `_decodeMeshToGeometryForGltfAsync()`
