[SOLVED] Error when loading glb compressed with Draco

I’m new with GLB compressed with Draco. I can see this model in the Playcanvas gltf viewer without any problem.

But when I’m trying to load it like this:

this.app.assets.loadFromUrl("../path/to/3dModel_draco.glb", "container", (err, asset) => {

I’m getting this error:

> Error loading model: 3dModel_draco.glb [TypeError: Cannot read property 'buffer' of undefined]

Do I miss something? Do I need to define that it’s compressed with Draco somewhere for decoding purpose?

Have you got the Draco library in your project?

1 Like

Except by loading draco.js and draco.wasm.js files from here, no. This told me that something is really missing.

By reading this forum post, I was thinking that the engine will handle that.

Can you explain or point me to some resources to be sure that I’ll do that correctly?

Here’s an example project: https://playcanvas.com/project/730372/overview/loading-draco-compressed-glbs

All I really did was drop the Draco library files into the project :thinking:

1 Like

This is working perfect in your project! But, if I copy the folder “Draco Lib” in my project, it’s still doesn’t work.

In your project, if I do this:

var decoderModule = window.DracoDecoderModule;

//Print the content of draco.js

I get an object:

But in my project, If I do the same thing, I get the content of draco.js:

Another strange thing is, in your project, you checked the draco scripts to be preload. But if you export/download the project, the config.js generated set these scripts to preload = false. Still, if you launch your exported project, the script will be loaded automatically.

I don’t have this behavior in my project. If I exported mine, preload is reset to false too in config.js, but my project will not load these scripts automatically, getting this error:

Error loading model: HeartDraco.glb [TypeError: Cannot read property 'buffer' of undefined] playcanvas-stable.min.js:1022

I manually edited my config.js to set the draco.js preload attribute to true. The script load but still, I get some error like:

Error loading model: HeartDraco.glb [TypeError: q.DecoderBuffer is not a constructor]    playcanvas-stable.min.js:1022 

It is like my project is not configured or set to use Draco…

Is it really just dropping Draco library files into the project? Did you manually create the folder and drop these scripts one by one or did you use another way?

Ok, I got more useful information:

When I download your project, the file “__ settings__.js”, there is:

    {'moduleName' : 'DracoDecoderModule', 'glueUrl' : 'files/assets/37509202/1/draco.js', 'wasmUrl' : 'files/assets/37509228/1/draco.wasm.wasm', 'fallbackUrl' : 'files/assets/37509224/1/draco.wasm.js', 'preload' : true},

But in my project, in the exact same file, we can see:


How can we configure the modules in the editor?


My error was that this field was empty…

:man_facepalming: :man_facepalming: :man_facepalming:


Did you use copy and paste assets feature?

And yes, we should add documentation about module loading :frowning:

1 Like

Copy and paste between project without fork? No. I didn’t know that.

Yep https://developer.playcanvas.com/en/user-manual/designer/assets/ (scroll down to copy and paste)

Use Ctrl + C to copy in a read only project

1 Like