How to import GLTF?

Hello, I want to import a gltf or glb file but I’m not sure how to do that… what is the right workflow for that?
are there any specific settings I need to set for exporting it? is Darco compression supported? thanks!

Draco compression is supported but it has been configured by Editor tool yet. For the moment, I would export without Draco compression.

GLB loading is supported by the engine API but we are still working on what is the best method to handle GLB containers in the Editor.

For the moment, you can load GLB containers. Check this scene for an example: https://playcanvas.com/editor/scene/924388 and this script: https://playcanvas.com/editor/code/655732?tabs=31081107

If you want to dive deeper into this, check the viewer tool that we will be publishing soon for more details: https://github.com/playcanvas/engine/tree/master/tools/viewer/src

okay thanks for you help! i’ll try that.

@yaustar does the editor currently convert fbx files to glb with Draco compression? We’ve got a heavy scene with lots of geo so would be great to know if we can save a few more bytes

Not with Draco unfortunately. You can export the FBX to GLB with Draco outside of PlayCanvas and load the GLB directly (e.g. https://developer.playcanvas.com/en/tutorials/loading-draco-compressed-glbs/)

There are a couple of things to work around though.

Ahh ok that’s cool. I wonder if the following might be possible

We currently have a build step where we grab the assets from Playcanvas and create a copy of the textures at half the Res. It actually works really well and allows us to switch between high/low quality at runtime. I wonder though if we could do the same with the glb files. On build run through all the glbs and Draco compress and just replace them?

Would the engine pick the assets and auto decompress? Or would we need to manually import the Draco decoder?

You will need to add the Draco library manually to the project. The example project above does this.

Interested in how you are doing this as it’s not easy with the current material system

It’s pretty crude. We’re just copying the config file in our build step and rewriting the paths in the assets. So we end up with 2 configs. One with hi Res textures and one with low. Just before we load the app we just choose which config to load.

I was thinking about running all the textures into basis files. Just thinking of smart ways so our guys can just work with source assets

1 Like

I’ve been checking out the engine and it seems the glb-parser.js is looking for the draco decoder and runs the mesh data through it? I can’t tell if this code path is used during the glb loading, but it looks like it might.

It should be, yes.