Virtual - Augmented - Mixed reality and the
immersive web
Vincent Ogloblinsky
Compodoc maintainer
Google Developer Expert on Web Technologies
Software architect
Wikipedia
Wikipedia
Wikipedia
Reality
Augmented reality
Virtual reality
Real world
Computer-generated
2018
Now in a mature state
Add an AR experience in a web page for :
- create engagement
- create empathy
- create action
Shopping
Education
Entertainement
Very fast
Web-based : three.js + jsartoolkit5
Open Source
Standards : webgl + webrtc
Depends on a real marker
DEMO : Let's rebuild Ikea Place ©
Physical marker
Device camera
JS ARToolKit
AR.js
Aframe
WebARonARKit
WebARonARCore
Mozilla WebXR Viewer
DEMO : Let's rebuild again Ikea Place©
ARKit
Device camera
ARkit / ARCore
Aframe-ar
Aframe
three.ar.js
WebXR Viewer
First generation JS API for Virtual reality started in 2014-2016
Work in progress API, not supported everywhere
Maslow’s hierarchy of a Progressive Enhancement project, by Arturo Paracuellos
For any platform to succeed, the barrier needs to be sufficiently low that artists can experiment with it freely, and expanded tooling is essential to attracting more people into creating for the medium.
WebXR is going to bring VR and AR to the masses. Here’s why. by Owen Williams
DOM Overlay
Anchors
AR Lighting Estimation
Proposal
Experimentation
Origin Trial / flag
Shipped
WebXR API
Hit testing
Depth API
navigator.xr.isSessionSupported('immersive-ar')
.then((supported) => {
if (supported) {
// 'immersive-ar' sessions are supported.
// Page should advertise support to the user.
} else {
// 'immersive-ar' sessions are not supported.
}
});
navigator.xr.requestSession('immersive-ar', {requiredFeatures: ['hit-test']})
.then(xrSession => {
console.log('requestSession immersive-ar ok');
// Do necessary session setup here.
// xrSession = session;
onSessionStarted(xrSession);
})
.catch(err => {
// May fail for a variety of reasons.
});
function onSessionStarted(xrSession) {
xrSession.addEventListener('end', onSessionEnded);
let canvas = document.createElement('canvas');
gl = canvas.getContext('webgl', { xrCompatible: true });
xrSession.updateRenderState({
baseLayer: new XRWebGLLayer(xrSession, gl)
});
xrSession.requestReferenceSpace('local')
.then((refSpace) => {
xrRefSpace = refSpace;
xrSession.requestAnimationFrame(onXRFrame);
});
}
function onXRFrame(time, xrFrame) {
let xrSession = xrFrame.session;
session.requestAnimationFrame(onXRFrame);
// Render a frame.
}
function onXRFrame(time, xrFrame) {
let xrSession = xrFrame.session;
// Queue up the next frame
xrSession.requestAnimationFrame(onXRFrame);
let xrViewerPose = xrFrame.getViewerPose(xrRefSpace);
if (xrViewerPose) {
// Our XRFrame has an array of views. In the VR case, we'll have
// two views, one for each eye. In mobile AR, however, we only
// have one view.
for (let view of xrViewerPose.views) {
// Render something
render(scene, camera);
// prepare anchors
processXRInput(xrFrame);
}
}
}
function processXRInput(xrFrame) {
let xrSession = xrFrame.session;
const sources = Array.from(xrSession.inputSources).filter(input => input.targetRayMode === 'screen');
const pose = xrFrame.getPose(sources[0].targetRaySpace, xrRefSpace);
if (pose) {
placeModel();
}
}
function placeModel() {
let hits, raycaster = new THREE.Raycaster();
raycaster.setFromCamera({0,0}, camera);
const ray = raycaster.ray;
let xrray = new XRRay(ray.origin, ray.direction);
hits = xrSession.requestHitTest(xrray, xrRefSpace);
if (hits && hits.length) {
const hit = hits[0];
const hitMatrix = new THREE.Matrix4().fromArray(hit.hitMatrix);
model.position.setFromMatrixPosition(hitMatrix);
}
}
function onSessionEnded(event) {
xrSession = null;
}
Not supported everywhere
In-development : Firefox / WebKit
Safari implementation : non-official in-progress (Fernando Serrano recruited at Apple)
WebXR API enabled by default
Google Chrome Beta 79
WebXR API Emulator
DEMO : Let's rebuild again Ikea Place ©
ARCore
Device camera
ARCore
three.js
Google Chrome Canary
Designing the Wider Web - Trevor Smith
Brandon Jones
WebXR developer at Google
Blair MacIntyre
Research Scientist at Mozilla
Jordan Santell
Indie engineering consultant
Ada Rose Cannon
Developer Advocate at Samsung
Josh Carpenter
Indie UX designer VR/AR
Diego Gonzalez
PM Edge for PWA
American computer scientist and Internet pioneer, widely regarded as the "father of computer graphics".
The screen is a window through which one sees a virtual world. The challenge is to make that world look real, act real, sound real, feel real.
- Ivan Sutherland -
WebXR Primer by Brandon Jones
Writing Vr and Ar apps with web technology by Michaela Lehr
WebVR, WebXR and A-Frame - Intro to the Next-Gen Web by Dr. Pete Markiewicz
WebXR : Introducting Mixed reality and the immersive web by Peter O’Shaughnessy & Diego González, Ph.D
The future of the web is immersive / Google I/O '18
Brandon Jones & John Pallet
WebXR : Introducting Mixed reality and the immersive web
Peter O'Shaughnessy
Augmented Reality: Past, Present, Future | JSConf Iceland 2018
Raisa Cuevas
A Roadmap for Future AR Technology in WebXR
Blair MacIntyre
Exploring Augmented Reality on the web - JSConf EU 2018
Jordan Santell
Ask me anything during the conference
Slides : bit.ly/webxr-api