WebVR Boilerplate
A THREE.js-based starting point for VR experiences that work well in both Google Cardboard and other VR headsets. Also provides a fallback for experiencing the same content without requiring a VR device.
This project relies heavily on the webvr-polyfill to provide VR support if the WebVR API is not implemented.
Projects that use the webvr-polyfill or webvr-boilerplate
Assorted platforms:
- A-Frame - Building blocks for the virtual reality web
- Archilogic - Floor plans into 3D virtual tours
- Vizor - Create and share VR in your browser
Assorted real-world examples:
- Breakthrough - Cutting-edge science that will change our lives in the very near future (by National Geographic)
- Chinese New Year - Create a virtual lantern and share your wishes (by Google)
- Discovering Gale Crater - A virtual reality audio tour of the Gale Crater (by LA Times)
- Sechelt - A visualization of an inlet near the town of Sechelt, BC (by Mozilla)
Assorted samples:
- WebVR 1.0 Samples - Simple example applications to demonstrate various aspects of the WebVR API
Features
As of WebVR 1.0, this project relies on the polyfill for even more. Core features like lens distortion and device detection have moved into the polyfill. This project now acts as a getting started example, and provides a reasonable user experience for getting in and out of Virtual Reality and Magic Window modes.
As a convenience, the WebVRManager emits certain modechange
events, which can
be subscribed using manager.on('modechange', callback)
.
Getting started
The easiest way to start is to fork this repository or copy its contents into a new directory.
The boilerplate is also available via npm. Easy install:
npm install webvr-boilerplate
Thanks
- Brandon Jones and Vladimir Vukicevic for their work on the WebVR spec.
- Ricardo Cabello for THREE.js.
- Diego Marcos for VREffect and VRControls.
- Dmitry Kovalev for help with lens distortion correction.