Preferred wrokflow for Appending models to scene from zip archive or similar

What is preferred wrokflows for Appending models to a scene from a zip archive or similar?

There is docs for the supported 3d file formats. Is there a dedicated/specific way for archives as well?

Well you will have to use something like zip.js to get the data and then use regular loaders

I see.
But the problem with that way is I give Babylon.js toplevel file path and name, like gltf or obj while loading non standalone file formats to scene, and loader starts HTTP request(s) with the urls inside this top-level file to load other files, like bin file, mtl file, or texture files.

Is there a way to load in this sort of case without a roundtrip to an HTTP server?
(Sorry for no formatting since I am mobile)

you must do you own xhr, get the data, uncompress it and then call load from a blob for instance so there will be only one call

Why not relying on http compression ? it might be a lot easier and gzip size will end up pretty close ?

@Deltakosh Does that mean I do not use the SceneLoader.AppendAsync etc methods or ImportMesh.
I do not know how to handle this. Need to do more work and research. Any help appreciated.

@sebavan can you elaborate on that?

You can enable gzip at the transport level so all your resources will transfer compressed the cost of uncompress and decompress is pretty tiny and far less than using any JS implementation. It would fit if you are trying to limit bandwith.

1 Like

Besides, I wonder the scenario that user need to add a gltf model from the client computer with following possible file structure:

alien.gltf
alien.bin
textures/texture1.png
textures/texture2.png

without imposing a constraint on the user of having a server roundtrip.

BJS Sandbox does this if no subfolder exists.

Why not simply relying on glb in this case ?

Imposing zip night be more annoying than the round trip.

Because generally users are working wih obj and gltf.

I aggree:

Even we impose zipping the round trip is still inevitable for our Mr. Anderson (Neo) users unless something done for locally loading from subfolders too.

Is there a plausible way to do this?

No you can not control local files from your browser aside of Drag and drop. This is mainly for security reasons.

I see. Actually the above scenario does not work with dragndrop either.

I think if it was possible to make a load without causing loader to make subsequent http requests, like SceneLoader.Append, it would be easy to load such subfolder including cases too with directory and webkitdirectory attribute of input element.

I will be checking docs for such loading method just loads the argument not the references it mentions.