Exporting gltf from web worker

I haven’t tried this yet, but I’m assuming it won’t work. I’m unclear how I would transfer the meshes back to the main app where I can export them. Any help? Even an outline? Is the Draco compression source something I could look at for inspiration?

Did you try to export the GLTF to a blob and pass it back to main thread as a an arrayBuffer ?

1 Like

Here is the simple example of passing blob from worker - https://playground.babylonjs.com/#H9PYXY#4

It is completely different thing, still may be inspirational in some regards.

1 Like

@lowclouds I just wrote you an example passing the scene export from worker to main using arrayBuffer :

@labris ahah you were faster :stuck_out_tongue:

2 Likes

Ahh, you two are great! I think I can get where I need to go from here. My hope is to run babylon in an offscreen canvas and do all the real work in the worker, but I want to be able to save the gltf to a file. Can I just turn around and save the blob in main rather than import it into a babylon instance running there?

1 Like

Absolutely, you can trigger a download directly on the blob data :

2 Likes