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

SceneViewer fails to open a GLB file with multiple scenes and multiple animations #4185

Open
1 of 3 tasks
rla-inneo opened this issue Mar 30, 2023 · 3 comments
Open
1 of 3 tasks
Assignees
Labels
flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue

Comments

@rla-inneo
Copy link

rla-inneo commented Mar 30, 2023

Description

This issue is related to the SceneViewer on Android and not the model-viewer.
The demo contains a GLB file with two scenes "first" and "second" and two animations "move" and "rotate".

Steps to reproduce

  • Open the demo and try to view "Multi Scene and Multi Animation" in AR on an Android device

Expected behavior

  • Display the "first" scene of the model and play the "move" animation like the model-viewer does

Actual behavior

  • The SceneViewer shows the message "Couldn't load object" and exits

Additional information

The GLB file is valid through Khronos' glTF Validator tool.

Oddly the glTF spec doesn't have a way to assign an animation to a specific scene. My guess is that the SceneViewer stumbles when trying to load the "rotate" animation and can't find any fitting node in the "first" scene.

The demo contains a second model "Multi Scene and Single Animation" in which the second scene does not contain an animation. This one loads just fine.

Live Demo

https://jumbled-sepia-hedgehog.glitch.me/

Version

  • Does not apply

Browser Affected

  • Does not apply

OS

  • Android

AR

  • WebXR
  • SceneViewer
  • QuickLook

If this is not the right place to report SceneViewer related issues I apologize. But it seemed through past issues in this repo that it is the most fitting.

@elalish elalish added the flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue label Mar 30, 2023
@elalish
Copy link
Collaborator

elalish commented Mar 30, 2023

Thanks, yeah it's the closest we have. @AdrianAtGoogle can you find the right place for this bug?

Also @emackey, is this animations with multiple scenes thing something that needs to be clarified in the spec?

@emackey
Copy link

emackey commented Mar 30, 2023

This is a very interesting test case, thank you! It would seem reasonable that if an animation targets node(s) not in the current scene, those targets should be ignored during the animation.

BabylonJS takes this one step further, and doesn't offer the animation that doesn't apply. For example in VSCode you can see it only offers the "move" animation for scene 0, and if you switch the default scene to 1, it only offers the "rotate" animation. Other rendering engines I've tried seem to get badly confused by this.

I suspect the glTF spec doesn't much need an update, although it's unfortunate that engines have to work out for themselves which parts of which animations can apply to which scenes. Still, it's just a matter of checking whether a given animation target node exists in the scene, and being prepared to ignore references to nodes from other scenes in the animations list.

Perhaps we need a new test model (without Draco and without the CC-BY-NC helmet) as part of the official sample models.

@elalish elalish assigned elalish and AdrianAtGoogle and unassigned elalish Mar 30, 2023
@rla-inneo
Copy link
Author

rla-inneo commented Mar 31, 2023

Thank you very much for the quick responses!

BabylonJS takes this one step further, and doesn't offer the animation that doesn't apply.

Is this a feature that could also be useful for the model-viewer? Currently, the availableAnimations property returns all animations in the model, but adding animation-name="rotate" in my demo did not result in any errors. However, it still tries to play the animation on the wrong scene, which may lead to some unexpected outcomes if the hierarchies do not align.

Altough it seems like a minor quirk since there is no way to select a scene in the first place and the playback of an incompatible animation has to be deliberate. It might be more beneficial to have an extension to the GLTFLoader of THREE that offers this functionality on the lowest level - then the implementation here would be trivial.

Perhaps we need a new test model (without Draco and without the CC-BY-NC helmet) as part of the official sample models.

That sounds great. I have updated my demo by using a license-free cube mesh, and I am happy to submit a pull request to the gltf-Sample-Models repo to take it further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: not model-viewer Problems that are related to our project but are ultimately some other project's issue
Projects
None yet
Development

No branches or pull requests

4 participants