Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process multiple scenes without merging them #184

Closed
Inviz opened this issue Oct 8, 2020 · 9 comments · Fixed by #188
Closed

Process multiple scenes without merging them #184

Inviz opened this issue Oct 8, 2020 · 9 comments · Fixed by #188

Comments

@Inviz
Copy link

Inviz commented Oct 8, 2020

I really love gltfpack. The speed and quality of code is superb. But I wish there was a bit more control over certain aspects of it. One of them is ability to process multiple scenes. Right now gltfpack outputs a single scene. So i have to use gltf-transform to preprocess file to turn scenes into root nodes.

Another semi-related thing would be super lovely to support multiple input files and glue them together as different scenes. Right now i also do that with gltf-transform, but it all takes a lot of plumbing and hacks

@zeux
Copy link
Owner

zeux commented Oct 8, 2020

I could add support for multiple scenes; my understanding previously has been that this is poorly supported, some discussion in KhronosGroup/glTF#1542 and other issues on glTF repository. Having said that, I don't think it's going to be too difficult to support, although I don't know if I will be able to find good examples to test against.

Merging multiple input files is challenging though due to how some parts of gltfpack are implemented - parts of the pipeline today use the raw data from the source glTF file (via cgltf library) so the ability to process that is limited...

@zeux
Copy link
Owner

zeux commented Oct 8, 2020

If you have an example of a model with multiple scenes that'd be great, since glTF-Sample-Models which I usually use for testing doesn't have one.

@Inviz
Copy link
Author

Inviz commented Oct 8, 2020

Basically, blender exports multiple scenes in a very meaningful way. It's like separate "root" nodes. When there're multiple scenes, one of them is "main" (accessible as like gltf.scene), it is usually the ones that blender was in while exporting. I am not super sure if there's duplication in that case (i.e. if gltf.scene is accessible as gltf.scenes[n] or is it something that GLTFLoader does).

@Inviz
Copy link
Author

Inviz commented Oct 8, 2020

Let me make you one

@zeux
Copy link
Owner

zeux commented Oct 8, 2020

"scene" is just a reference to one of the scenes, there should be no duplication in glTF file

@Inviz
Copy link
Author

Inviz commented Oct 8, 2020

Multi-Scenes.zip

Here's glb, gltf and blender files.

Yes, that's right. Scene is just numeric index. Just checked it myself.

@Inviz
Copy link
Author

Inviz commented Oct 8, 2020

With multi-scene setup there could be some really interesting things done. E.g. prefabs, merged files, different animation scenes, etc. Blender has very interesting (yet a bit buggy) support for creating different scenes from the same source files, that's what I use.

zeux added a commit that referenced this issue Oct 10, 2020
Before this change gltfack wasn't scene aware, and would process all
nodes regardless of which scene they come from.

With this change, we now output the same number of scenes that the input
file contained. When merging meshes and converting nodes to mesh instances,
the process is limited to cases where the mesh is not used in multiple
scenes.

Fixes #184
@zeux zeux closed this as completed in #188 Oct 11, 2020
@Inviz
Copy link
Author

Inviz commented Oct 12, 2020

Wonderful work! Works well!

@Inviz
Copy link
Author

Inviz commented Oct 12, 2020

Just wanted to note again, that you are very prolific and your utility is top-class. Does what's advertised on the tin, and is extremely fast at that. On behalf of myself and others, thank you!

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

Successfully merging a pull request may close this issue.

2 participants