Combine multiple GLTF models into one GLTF file

I’m sorry that I have to ask such a question, but I do have a problem at present. I load my multiple models through AssetsManager, but I have to write a lot of MeshTask, so I hope I can merge the files and load them all at once

One way is to use a DCC software like Blender, 3ds Max, Maya or Houdini.
Load all the gltf files into the DCC, assemble a single scene and export a single gltf file.

For the time being, I don’t know how to merge gltf files without a DCC software.
Maybe there are some code resources to do it that I am not aware of.

Thank you very much!

Do you mean to import all the models through 3dmax and then export them as a whole? I have a scene of the whole Max.However, it has 610 megabytes, even if it is exported to GLTF format, it is still very large, I cannot load it out in the scene, and the company requires that the model must be loaded individually, because it is composed as a whole in the scene, rather than directly loaded in the whole way

In this case, loading them seperately migh just be the right way to go.:grinning:

On a side note, if you are including textures in the gltf, try to reduce their sizes and us png or jpg instead of tga or tiff, which are just too big or not supported.

Just been curious, what’s in those scene files that make them so big? I guess alot of polygons?

Thank you!
What you said is right, because the model number too much, but that’s because modelers have done before, I don’t understand this, can only use his model to realize I want to do, but are not satisfied, just now I try to use the unity export GLTF model, the effect is good, but for a question, is I can’t custom he coordinates, this I don’t know for what reason
i just sent this question, you can see the picture

I have the same problem as you. How do you merge multiple gltf files

As hcmetal said, the simple way is probably to use a DCC like Blender (free & open source).

Launch Blender and just go to File > Import > glTF
image

Once all your gltf are loaded, use File > Export > glTF, and choose your export settings on the right of the popup window

Same question here -
Am wondering if there’s a server-side method to take all of the GLBs that have been loaded into a Babylon scene and to export them to a single new GLB - in order to prevent the overhead involved in loading multiple GLBs. My specific use case is one where the combination of GLBs is user created and therefore not predictable, so Blender or other manual process is out.

I see in the debugger there is a “GLTF Export” tool - but that always errors out for me.

toolsTabComponent.tsx:285 Uncaught TypeError: Cannot read properties of undefined (reading 'GLBAsync') at jl.exportGLTF (toolsTabComponent.tsx:285:21)

Even it if worked though - I’m looking for a process I can run automatically on server side to create the GLB. Maybe possible via Gltf transform and some combination of Babylon apis?

-ben

1 Like

cc @bghgary for this one.

I don’t know if glTF-Transform can load multiple files, but if it can, then doing that on a server seems reasonable. Other JS options like loaders.gl might work. If you are willing to go native, some libraries like assimp or glTF-SDK might work. These are just possibilities. I haven’t tried these options myself.

2 Likes

Very late reply here but, yes:

1 Like

I did consider adding a button in the sandbox to append GLTF files to the scene, then the export button should work. Is there a good reason why this wouldn’t be a good PR?

glTF loaded into Babylon.js does not currently roundtrip, e.g., the scene structure may change after importing and exporting (the most common one being the glTF primitives splitting into separate meshes). The glTF exporter also has a bunch of issues that I will hopefully be able to address in the coming months.

2 Likes