Is it possible to load a GLTF file via the JSON in a Babylon file?
Thank you for the response, but I should clarify that I meant the JSON in the .babylon file format: FileFormat Map (.babylon) - Babylon.js Documentation
It should be exactly like in the above examples. That ‘GLTF’ from title confused me
Sorry about that! I don’t think I fully understand what you mean. I know how to load GLTF files similar to the examples you linked, but I’m wondering if it is possible to have a .babylon file that contains the location of some GLTF file so that I can create the full scene from the JSON in one .babylon file in one function call.
I don’t know actually if you can or not, but I see no reason actually.
You can import as babylon file an entire scene with cameras, lights and meshes.
Or you can import meshes from a gltf file. Can you please elaborate a little bit about your scenario?
My team is interested in created a visualization tool in Babylon and I’ve been researching various topics as they come up. The babylon file format seems really useful for creating an entire scene but I didn’t find anything on loading a GLTF file in as a mesh directly from the babylon file rather than manually adding it to the scene after. I’m just curious if it is possible, although I think in most cases it would be much easier to add it to the scene separately.
Let see if somebody will have an idea.
Maybe you can import the gltf file in the scene and after this export the entire scene as babylon.
Or you can create your custom json file, but you’ll have to create a custom loader as well
Those both sound like ideas worth looking into. Thank you for the help!
Technically, yes you can.
Hi… My name is Mackey. I am the developer for the BabylonToolkit.
My first version of the toolkit used the native .babylon file to serialize custom user metadata and then i parse that metadata on load.
My new version uses native GLTF loaders/parsers… So i get what you are trying to do.
FYI… I just use GLTF to make the Whole or Main scene as well… (Not loading .babylon files at all)
Anyways… We added support for custom user metadata a long time ago so…
You could serialize metadata on your babylon scene json:
scene.metadata.myloader.gltffile = "http://myserver.com/myscene.gltf"
Then in babylon you will have metadata on your scene node as an any
Parse your scene.metadata.myloader.gfltffile property to get the url of your
sub gltf scene files…
Kind of alot of work… When you can just use GLTF for every thing…
FYI… GLTF has extras section support for its json… That is what i use to serialize all the Unity Metadata into native GLTF files and i use native GLTF for everything… I love the binary file support of gltf for things like animations, blend shapes and of course mesh data
Here is an example Babylon Toolkit prepared racing/driving mechanics playground.
Note: Everything is really coming from: SampleScene.gltf
Hope that help you out
Thank you so much! This is really good information.