Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Exporting one bin file per mesh #293

Closed
arturitu opened this issue Aug 31, 2018 · 6 comments
Closed

Exporting one bin file per mesh #293

arturitu opened this issue Aug 31, 2018 · 6 comments

Comments

@arturitu
Copy link

I saw that is possible to have multiple buffers (bin files) loaded with one gltf file, and I'm looking to have one bin file per mesh when I export a scene.
Is that possible now or is something that is on the roadmap to implement it?
Or you know someone/some branch that is trying to?

Why I'm trying to do this > I have an armature with different parts of the body / clothing items and my goal is to make possible to exchange this meshes (skinned meshes) that use a common armature (and animations).
In case there is another smarter solution, suggestions are welcome.

@donmccurdy
Copy link
Contributor

donmccurdy commented Aug 31, 2018

I’m thinking it would be most promising to have a standalone script that takes a glTF file as input and just splits the payload into multiple bin files. Probably something very similar to one of these projects:

The advantage there is that it could be applied to glTF files from any exporter. Also note that making efficient use of this structure would require changes in threejs (in progress: mrdoob/three.js#14779)

@arturitu
Copy link
Author

I was thinking about how to split into multiple bin files as you suggest but but I'm not sure where to start. I suppose we need to take the bin file from the original glTF convert to readable on js side, convert it again on multiple bin files and change the "buffers" node on the gltf to add the new ones, and the index/bufferLength/bufferOffset on "bufferViews". Is that premise ok? Meanwhile I try to find on the way to make this .bin > readable content > multiple .bin well split with JavaScript.

@donmccurdy
Copy link
Contributor

I think that's right. You may also need to split some bufferViews and update accessors referencing them, if meshes you want to split are sharing a bufferView.

@donmccurdy
Copy link
Contributor

Here is a (very experimental) first attempt: https://github.com/donmccurdy/glTF-Split

It currently requires each mesh to (already) be in a separate bufferView, which THREE.GLTFExporter does but other exporters may not. Probably that's not hard to fix but I didn't have the time.

@donmccurdy
Copy link
Contributor

Newer version, still quite experimental: https://github.com/donmccurdy/glTF-Transform

IMO this does probably seem more appropriate for tools outside the exporter itself.

@donmccurdy
Copy link
Contributor

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants