After adding support to Firefox for WebVR, an open specification enabling the experience of virtual reality (VR), Mozilla is now working on a new API, called WebXR, to bring mixed reality to the Web. Initially announced last year, WebXR aims to replace WebVR in time and to offer a smooth transition for developers using WebVR.
As Mozilla research engineering manager for VR/AR, Lars Bergstrom wrote:
We’re entering a new phase of work on JavaScript APIs here at Mozilla, that will help everyone create and share virtual reality (VR) and augmented reality (AR) projects on the open web.
The new WebXR Device API will provide the foundations to build augmented reality experiences in the browser by enabling the integration of the real-world with contextual overlays. For example, users could replace a Web page background with a skybox, that is a live image representing anything that is beyond immediate reach, such as the sky, a mountain, distant buildings, etc. Additionally, to allow users to navigate virtual spaces more naturally, WebXR will support different kinds of user inputs, including voice and gestures.
The WebXR community is working on draft specifications that target some of the constraints of today’s wireless devices. For instance, creating a skybox setting you can use to can change the background image of a web page. We’re also working on a way to expose the world-sensing capabilities of early AR platforms to the web, so developers can determine where surfaces are without needing to run complex computer vision code on a battery-powered device.
The current draft for WebXR covers light estimation, eye tracking, skyboxes, static 3D favicons, controller support, computer vision, and more. Web pages will be able to detect and query VR/AR capabilities, poll device orientation and position, and produce graphical frames at the required frame rate during an immersive AR session. Although the specification is not yet stable, Mozilla is planning to move forward based on its current state and then make all required adjustments as they become necessary.
At the beginning, support for immersive experiences will come through a specific version of Firefox, dubbed Firefox Reality, but later on it will extend to every platform where Mozilla supports WebVR, including Windows, Linux, macOS, Android, and iOS. For the iOS platform, Mozilla has already released an AR app, based on Apple’s ARKit, whose source code is available on GitHub. Mozilla iOS WebXR Viewer app is a sort of playground for Mozilla engineers to experiment with AR ideas for WebXR.
To dig deeper into WebXR, do not miss the current specification draft and the WebXR Device API Explainer, which also includes a wealth of code snippets to carry through basic tasks such as querying device capabilities, opening an XR session, outputting graphical content, etc.