Support and Availability
Today the WebXR Device API is under development, but you can try it out with:
#webxrflag in Chrome 66 and later.
- As an Origin Trial in Chrome 67 and later.
It's also available through the WebXR Polyfill. Bear in mind, that VR is extremely performance-sensitive and polyfills typically have a relatively large performance cost, so it may be worth considering whether or not you wish to use the polyfill for a user who doesn’t have native support for the WebXR Device API.
When in doubt, avoid giving people motion sickness through poorly-performing experiences!
Creating WebVR Content
Get Started with WebVR
Make a flying start with WebVR by taking a WebGL scene and adding VR APIs.
Add Input to a WebVR Scene
Interaction is a crucial part of providing an engaging and immersive experience.
There are some excellent WebVR resources beginning to appear around the web.
Keep track of your performance
In order to minimize discomfort for the people using WebVR experiences, they must maintain a consistent (and high) frame rate. Failing to do so can give users motion sickness!
On mobile devices the refresh rate is typically 60Hz, which means the target is 60fps (or 16ms per frame including the per-frame browser’s overhead). On desktop the target is typically 90Hz (11ms including overhead).
To meet those goals you will need to test regularly on your target devices, and should use Chrome DevTools’ Timeline to measure your per-frame costs.
Embrace Progressive Enhancement
What are you to do if your users don’t have a Head Mounted Display (‘HMD’) or VR-capable device? The best answer is to use Progressive Enhancement.
- Assume the user is using traditional input, such as a keyboard, mouse, or touchscreen with no access to a VR headset.
- Adapt to changes in input and headset availability at runtime.
Thankfully the WebVR APIs make it possible to detect changes in the VR environment for us to discover and adapt to changes in the inputs and viewing options in the user’s device.
By assuming a non-VR environment first you can maximize the reach of your experiences, and ensure that you’re providing the best possible experience no matter what setup your users have.
For more, read our guide on adding input to a WebVR scene.