-
Notifications
You must be signed in to change notification settings - Fork 0
WebXR notes
Replaces [WebVR]
"The WebXR device API is for accessing virtual reality (VR) and augmented reality (AR) devices, including sensors and head-mounted displays on the Web"
Current support: https://caniuse.com/?search=webxr
- Some browsers require extra flags to enable it
- It's a very large API and most browsers have only partial support yet
- Chrome, Edge, Safari, Chrome-Android, Samsung-Internet
- Firefox currently supports a "polyfill" of webxr that runs on webvr
- Device support has been mixed, e.g. Vive has been problematic for more than a year, but is now working again
- Requires HTTPS
- Doesn't work inside Codepen unfortunately, due to missing flags on the iframe
Pros
- It's not a closed system owned by a single company
- It's based around "sites" rather than "apps"
- You don't install these, you navigate to them
- Live update/live coding is much more feasible
- Really easy to link into other web capabilities, web services, etc.
- Far more naturally oriented to multi-user / telematic
- Works on desktop and mobile without needing separate skills/production workflows
Cons
- Content must be streamed rather than installed
- Thus, content should use lightweight assets not gigabytes
- Similarly limited usage of local memory storage (use server instead)
- More limited access to peripherals etc., including file system
- Performance likely slightly less than a desktop app
- Limited to secure site hosting (codepen doesn't work, github-pages does work)
- At the mercy of browser/device support (vs. at mercy of OS and app store...)
It uses WebGL to do rendering on the GPU. Many higher-level libraries on WebGL enable WebXR, e.g. Three.js, which has WebXR support.
It uses OpenXR to talk to hardware, which means it (in theory) works with Oculus, WindowsMR, Hololens, SteamVR, etc.
- API: https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API
- Samples: https://immersive-web.github.io/webxr-samples/
- https://github.com/immersive-web/webxr
- state of webxr support: https://docs.google.com/document/d/1R8Bz0_vK9YmY5-ZhsbLtZ9-DDJpTOgNeibFD4SdUnbw/edit
- There's an emulator
To enable in Chrome, go to chrome://flags, search "XR", enable everything EXCEPT disable XR sandboxing (as this breaks Vive/Oculus usage for some reason)
Q: how to enable 'stay in vr' mode like we had in webvr, so that page links/self-reloads happen without having to click 'enter vr' and give permissions.
- Site must be secure hosting (HTTPS) -- github pages is OK here
- iframe must have allow="vr" enabled (Three.js seems to deal with this for us)
- WebXR API is still in flux and not fully implemented/supported over various combinations of OS, browser, hardware, etc.