about me:

Trần Trọng Thanh

Front End & JavaScript Specialist

Co-founder & CTO Nau Studio
Lecturer at NordicCoder.com
Website: int3ractive.com
Github, Twitter, Facebook: @trongthanh

My FLARToolkit Presentation at Hanoi Flashcamp
My AR for Flash (FLARToolkit) talk at Hanoi Flash Camp 2010

Augmented Reality in

WebXR

12-2018

How did we get here?

2005

HTML5 and Canvas 2D

2007

first iPhone and
smartphone revolution

Photo: Steve Job introduce iPhone in 2007

2010

Three.js

Image: THREE.js Geometries example page

2011

WebGL and Canvas 3D

2012

DeviceOrientation Event and other device API

2014

Google cardboard and VR on the phone

2016

WebVR API

2017

ARKit on iOS 11+ and ARCore on Android 7+

Next generation augmented reality

Can the Web do that?

AR.js

How AR.js work?

AR.js layers

Marker detection by emscripten ARtoolkit. 3D rendering by three.js

AR.js is good but not ideal!

  • Require markers
  • Markers must be fully visible
  • Not making use of ARCore and ARKit*
  • No hardware and chipset support*
* At least for now

2018

WebXR

Mixed Reality / Cross Reality

Immersive spectrum
  • WebXR is the successor of WebVR API
  • WebXR cater for both AR & VR experience
  • Official name: WebXR Device API

Why is WebAR awesome?

  • No external viewer device
  • No app installation required
  • Just the Web and a smartphone
  • Progressive enhancement

Getting started with WebAR
in WebXR Device API

Prerequisites

  • Android Chrome Canary >=70
  • Android 8 Oreo
  • ARCore (from Google Play)
  • Supported devices*
  • Enable webxr-... flags in Chrome
*(Pixel Phone, Nexus 5X+, Samsung S7+, Mi 8+...)

Sample code: detect and init

class App {
  ...
  async init() {
    if (navigator.xr && XRSession.prototype.requestHitTest) {
      try {
        this.device = await navigator.xr.requestDevice();
      } catch (e) {
        this.onNoXRDevice();
        return;
      }
    } else {
      this.onNoXRDevice();
      return;
    }
	...
  }
}
Warning: API Draft, subject to change.

Sample code: start XRSession

class App {
  ...
  async onEnterAR() {
    const outputCanvas = document.createElement('canvas');
    const ctx = outputCanvas.getContext('xrpresent');

    const session = await this.device.requestSession({
      outputContext: ctx,
      environmentIntegration: true,
    });
    document.body.appendChild(outputCanvas);
    this.onSessionStarted(session);
  }
}
Warning: API Draft, subject to change.

Placing object in real world: WebXR Hit Test

WebXR hit test
Also known as: ray casting

DEMO

Exciting upcoming features:

  • Measuring real world light
  • Understand surface and mesh
  • Depth information
  • Point clouds

Applications?

  • Online shopping

Applications?

  • Online shopping
  • Education

Applications?

  • Online shopping
  • Education
  • Entertainment
  • ...
Brendan Eich - always bet on JavaScript
Brendan Eich (JS creator) with topic LOLJS - JSConfEU 2011
"Always bet on the Web"
- Thanh Tran

Thank You

Questions?

The End!

Learn more: