Unaccounted for WebXR state when not enough detail present in the environment
See original GitHub issueDescription
When entering WebXR, there appears to be an unaccounted for state, prior to ‘session-started’. It appears this state happens when the camera is not receiving enough information to even begin tracking the environment. For example, if the user is too close to a surface, the scene is too dark, or the user is looking at a very blank wall. The session-started
status only seems to begin once the WebXR engine is able to start tracking an environment with enough detail. It also appears that ModelViewer does not render the floating 3D model during this state.
This leaves us with a potentially anomalous state, when the WebXR session has actually started (the camera feed is on) but ModelViewer has not yet registered state as session-started
and the 3D model is not displayed. Potentially leading to a confusing state for the user.
It would be useful to be able to handle this state though, as it could be used to provide additional guidance to users during the WebXR experience - ‘unable to scan environment’, ‘needs more light’, ‘back up a bit please’, etc.
Live Demo
In the below demo, both JavaScript event listeners and CSS attribute selectors are being used to visually update status changes. You’ll notice that when WebXR session starts, and the camera is intentionally too close to a blank surface, we see the camera feed, yet the CSS attribute selectors still reflect status as not-presenting
, no JS ar-status
event has fired, and the 3D model is not rendered. Only when the camera is panned to reveal a little bit of detail - enough to start trying to track the environment - does the JS event and CSS update to a status of session-started
and the model then appears. By panning for more detail, we see the status change as expected from session-started
to object-placed
.
https://puzzle-chip-pluto.glitch.me/
Version
- model-viewer: v1.6.0
Browser Affected
- Chrome, version: 90.0.4430.91
- Edge
- Firefox
- IE
- Safari
OS
- Android, v 11
- iOS
- Linux
- MacOS
- Windows
AR
- WebXR
- SceneViewer
- QuickLook
Device
Pixel 4 XL
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
I like this idea, thanks for thinking it through. I think session-started not happening right at session start is a bug rather than a breaking change. As I was implementing the tracking event I realized it’s a little tricky because you always start out not tracking, but that’s expected; it takes a few frames to understand your space. I’m going to put in a delay so that it only sends a not-tracking event if it’s been long enough that there seems to be a problem.
Thanks for testing it! That’s good to hear.