immersive-web / webxr-polyfill

Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard
Apache License 2.0
378 stars 84 forks source link

Partial polyfilling; supporting native inline, polyfilled immersive #65

Open jsantell opened 5 years ago

jsantell commented 5 years ago

There is a scenario where inline sessions are supported (all WebXR implementations must support this), but no immersive session (e.g. an AR headset?).

If and only if an immersive session is needed and unsupported, the polyfilled stereoscopic view (cardboard-vr-display) could be included and supported, but it's a bit of a strange scenario where sessions can either be native or polyfilled.

A similar scenario in the webvr-polyfill existed, where Firefox for Android supported WebVR, but provided no VRDisplays. In this case without intervention, the WebVR spec is providing a worse experience than not at all. The solution was to (optionally), if on mobile, query for VRDisplays if the API exists, and inject a polyfilled VRDisplay only if none exist.

This is a bit of a gray area and could introduce some complexity. Practically speaking, I'd like to wait until there's a device/browser combo that could cause this where the polyfill could produce a more desirable experience.

jacobcdewitt commented 5 years ago

For WebXR, it's also required to support an inline session even when the device has no VR/AR capabilities as a matter of progressive enhancement. For example, https://storage.googleapis.com/chromium-webxr-samples/M76/magic-window.html uses WebXR and allows the user to view the scene on a regular screen and adjust the viewer pose with mouse or touch input even when no VR headset is connected and there are no orientation sensors, etc.

However, the current polyfill implementation does require a VR-capable device to be connected even to simply create an inline WebXR session.

jsantell commented 5 years ago

However, the current polyfill implementation does require a VR-capable device to be connected even to simply create an inline WebXR session.

To clarify, VR-capable browsers/devices aren't necessary, but it is necessary to create the underlying "XRDevice" inside the polyfill, or that which controls the pose, which is possible to not have any (e.g. on desktop or cardboard: false). This seems like two separate issues:

This issue can track the first, and IIUC, it sounds like you're describing the second issue; I'll file an issue for that with more info!