Using assetManager with draco compressed files

We would like to use Asset Manager to load assets, seems there are some nice conveniences . When it comes to models it appears this only works with things like gltf and glb? unless in mistaken. We would like to use it to load Draco .drc files.
Currently we load our assets using the draco decoder and then build geometry from that.
eg:
// raw binary .drc data is loaded from a URL
Tools.LoadFile(fullUrl, function (data) {
resolve(data);
}
}).then(…

blob = dracoCompression.decodeMeshAsync(data);
where data is the raw binary .drc file (loaded using Tools.LoadFile)

and then create the geometry using
var geometry = new Geometry(“dracoGeometry”, scene, model.blob);
geometry.applyToMesh(mesh);

So how can we use this process with the assetManager? Is there a way to “plug-in” the decoder handler into the assetManager pipeline?

This is a pretty good question for @bghgary but I do not think babylon format supports draco OOB.

I don’t know much about AssetManager, but after a quick look at it, it looks like it can be supported by adding a new class that derives from AbstractAssetTask and then have it use DracoCompression to load the geometry. It doesn’t look like you can easily extend this without extending the prototype of the AssetsManager or maybe someone can add a generic function for this to the AssetsManager. You can also contribute the code back into the main repo.

That said, do you have to use .drc files? Can you use .glb instead? If you can use glTF binaries using the KHR_draco_mesh_compression, then you can use the existing tasks to load.

Hello @Anupam_Das just checking in, was your question answered?

1 Like

@carolhmj you all are so punctual its appreciated! Our solution was we did away with .drc and went to glbs and we came up with a simple pipeline to batch convert all of our drcs to GLBs. GLTF is really the way forward.

That being said the it would be possible to build an asset importer ‘plugin’ for drc and then it would work with assetManager as mentioned above, but for us it wasn’t worth the effort.

2 Likes