Export scene to .gltf or similar (not from the Editor)

Is there a way to let the page visitor export a scene to a standard format like .gltf?

My use case is the following:

  • some internet user opens my site
  • that user creates a simple 3D scene on the page using some predefined objects
  • he then wants to save the scene to some standard file format

I can only see the SceneSerializer in the docs but it converts to a proprietary format.
The only docs about exporting are for the BabylonJS editor. So I guess it can be done but maybe it’s not been made into a library for anyone to use via code?

Thank you

1 Like

I don’t know how this technally works but the debugLayer have the function you need:

You may want to take a look at the src files: Babylon.js/inspector/src at master · BabylonJS/Babylon.js · GitHub

But surely a dev’ could helps you more than me :slight_smile:

1 Like

This feature is relying on the gltf exporter: https://www.babylonjs-playground.com/#1GXSPK#17

You can find all the info you need here: Babylon.js Documentation

3 Likes

The gltf exporter is what I missed, thank you!