How to use GLTF files in PlayCanvas?

I tried using Draco GLB compressor and I reduced the size of a GLB file from 280 kb to 30 kb, but the output is a GLTF file which I can’t use in playcanvas. When I convert back the GLTF into a GLB it grows again to about 277kb.

Is it possible to load .GLFT files in playcanvas? the size reduction would be huge.

Thanks in advance!

Hi @mrkarate,

Just to be sure, have you checked this example?

yes, that’s the base example I use, there they load a . glb file, but when I apply draco compression, first I have to convert to .gltf, then apply drago gltf, and that’s how I got the new compressed .gltf , I test with an external viewer (nothing related to playcanvas) and the model works.

I also use the gltf deprecated playcanvas library, to load a .gltf file but this library needs as inputs two files:
a .gtlf.json file (really small), and a .bin file, the example models works, but my model only is one single .gltf file, so is any way I can convert my model to a .bin and json files?, or are any other external viewer for playcanvas to load .gltf files?

1 Like

@mvaligursky @yaustar any idea how this works?

gltf file only describes the hierarchy, and the binary file stores meshes and textures. I guess gltf file only could work if you have no meshes nor textures.

Try this to compress your glb using draco:

@mvaligursky mvaligursky

this is a GLTF file we uploaded to an online GLTF viewer. The mesh is stored on the GLTF which we generated converting a GLB using draco.

The original GLB was an untextured mesh of 300kb and the converted GLTF is just 30kb, and still holds the geometry data.

The engine doesn’t support loading .gltf files directly. Only GLBs.

The viewer does some extra logic to support .gltf/.bin files

I’m very surprised that the GLB is larger than the GLTF when compressed with Draco. Can you share the original GLB file?


nevermind Yaustar, we were doing the GLB compression wrong. now we did it properly and the GLB is even smaller than the GLTF, what kind of witchery is this???. Hope playcanvas support draco GLBs natively in the future since it’s a bit tedious to assign materials in the current way

Also, do Draco GLBs support skinned meshes or only static ones?


1 Like

What do you mean by support? As in in the Editor so you can see if in the viewport?

exactly. in the editor to view draco GLBs in the viewport

1 Like

Sorry, forgot to reply back to this. There are plans this year to support GLB import into the Editor. Not sure about Draco :thinking:

Given that is post processing on the GLB itself, we may be able to have it as an option to do the compression in the Editor?

@slimbuck @mvaligursky any advance on this?

1 Like