SlideShare a Scribd company logo
AR/VR in JavaScript Apps
FITC Web Unleashed 2018
The Rise of Extended Reality (AR/VR)
• AR (Augmented Reality) – Interaction with physical realty
augmented with computer generated input and output
• VR (Virtual Reality) – Replace physical reality with a computer
generated one
• Hardware costs plummeting (Oculus Go launched F8 2018,
$199)
• Software for building AR and VR experiences getting better
every day
Introduction – Hasan Ahmad
• Principal Consultant at DEV6
• Developer Circles from Facebook
(Toronto)
• https://dev6.com
• https://www.facebook.com/groups
/DeveloperCirclesToronto/
• https://twitter.com/has_ibr_ahm
Industries that are embracing XR
• Gaming
• Media
• Mobile Apps
• Streaming
• Education
• Industrial
• Retail
AR/VR tech-stack for web devs
• Little bit of math & physics background
• Smartphone or VR headset
• Three.js
• WebVR API / Web XR API
• A-Frame
• React 360
• AR.js
• 3D Content
Three.js
• https://threejs.org/
• WebGL graphics library
• Scene – What to display
• Camera – What to view
• Renderer – How to display
• Geometry – Objects, textures, etc
$ npm install three
...
import { Scene } from 'three’;
const scene = new Scene();
OR
<script
src="https://fastcdn.org/three.js/73/three.min.js">
</script>
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera(75,
window.innerWidth / window.innerHeight,
0.1,
1000);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
var geometry = new THREE.BoxGeometry(1, 1, 1);
var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
var cube = new THREE.Mesh(geometry, material);
scene.add(cube);
camera.position.z = 5;
WebVR
• Low-level API to gather info about the VR display + capabilities
• Eye parameters, the data to render the scene for each eye
• Field of view data
• Position of the VR display (and velocity and acceleration)
WebXR (unstable!)
• Evolution of WebVR spec
• Much faster than WebVR API
• Better architecture to support both VR and AR, multiple view
types
• Desktop
• VR Headset
• Smartphone
• Magic Window
• Touchscreen, Mouse, Gamepad, Controllers
The future of the web is immersive (Google I/O ‘18)
https://www.youtube.com/watch?v=1t1gBVykneA
WebXR-Polyfill
• Best way to make sure code written to XR spec (proposal) will
actually work
https://github.com/immersive-web/webxr-polyfill
<script src='https://cdn.jsdelivr.net/npm/webxr-
polyfill@latest/build/webxr-polyfill.js’></script>
$ npm install --save webxr-polyfill
function initXR() {
xrButton = new XRDeviceButton({
onRequestSession: onRequestSession,
onEndSession: onEndSession
});
document.querySelector('header').appendChild(xrButton.domElement);
if (navigator.xr) {
navigator.xr.requestDevice().then((device) => {
device.supportsSession({immersive: true}).then(() => {
xrButton.setDevice(device);
});
});
}
}
function onRequestSession(device) {
device.requestSession({immersive: true}).then(onSessionStarted);
}
function onSessionStarted(session) {
xrButton.setSession(session);
session.addEventListener('end', onSessionEnded);
gl = createWebGLContext({compatibleXRDevice: session.device});
renderer = new Renderer(gl);
scene.setRenderer(renderer);
session.baseLayer = new XRWebGLLayer(session, gl);
session.requestFrameOfReference('eye-level').then((frameOfRef) => {
xrFrameOfRef = frameOfRef;
session.requestAnimationFrame(onXRFrame);
});
}
function onXRFrame(t, frame) {
let session = frame.session;
scene.startFrame();
session.requestAnimationFrame(onXRFrame);
let pose = frame.getDevicePose(xrFrameOfRef);
if (pose) {
gl.bindFramebuffer(gl.FRAMEBUFFER, session.baseLayer.framebuffer);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
for (let view of frame.views) {
let viewport = session.baseLayer.getViewport(view);
gl.viewport(viewport.x, viewport.y,
viewport.width, viewport.height);
scene.draw(view.projectionMatrix, pose.getViewMatrix(view));
}
} else {}
scene.endFrame();
}
A-Frame
• Web framework originally from Mozilla for rendering AR and VR
in web pages
• Declarative syntax
• 3D scene graph with markup language
<head>
<script src="https://aframe.io/releases/0.8.0/aframe.min.js"></script>
</head>
$ npm install aframe
...
require(‘aframe’);
<body>
<a-scene>
<a-box position="-1 0.5 -3"
rotation="0 45 0" color="#4CC3D9"></a-box>
<a-sphere position="0 1.25 -5"
radius="1.25" color="#EF2D5E"></a-sphere>
<a-cylinder position="1 0.75 -3" radius="0.5"
height="1.5" color="#FFC65D"></a-cylinder>
<a-plane position="0 0 -4" rotation="-90 0 0"
width="4" height="4" color="#7BC8A4"></a-plane>
<a-sky color="#ECECEC"></a-sky>
</a-scene>
</body>
Loading 3D Models
<a-assets>
<a-asset-item id="cityModel"
src="https://cdn.aframe.io/test-models/models/virtualcity/VC.gltf">
</a-asset-item>
</a-assets>
https://aframe.io/
https://aframe.io/aframe-school/#/
$ npm install -g react-360-cli
$ react-360 init Hello360
$ cd Hello360
$ npm start
React 360
React 360
• You can use React to
build VR web UIs
• Render React Native
components in 3D
import { AppRegistry, StyleSheet, Text, View } from'react-360;
export default class Hello360 extends React.Component {
render() {
return (
<View style={styles.panel}>
<View style={styles.greetingBox}>
<Text style={styles.greeting}>
Welcome to React 360
</Text>
</View>
</View>
);
}
};
React 360
• Similar in Architecture to React Native
• Uses Web Workers to avoid single-
threaded computation limitation, which
could impact performance, break
immersion
React 360
• Can also load 3D models, using Entity (multiple formats)
// to reference a GLTF2 model
<Entity source={{gltf2: asset('myModel.gltf')}} />
// to reference an untextured OBJ model
<Entity source={{obj: asset('myModel.obj')}} />
// to reference an OBJ with matching MTL file
<Entity source={{obj: asset('myModel.obj'), mtl: asset('myModel.mtl')}} />
Augmented Reality
• Similar problems solved in VR
• Must be able to identify real-
world geometry
• Capable of marker-based AR at
60fps, even on budget
smartphones
https://aframe.io/blog/arjs/
Building AR with A-Frame (AR.js)
<script
src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js">
</script>
<a-scene embedded arjs>
<a-marker-camera preset='hiro'></a-marker-camera>
Hiro Marker
Building AR with A-Frame
<body style='margin : 0px; overflow: hidden;’>
<a-scene embedded arjs>
<!-- create your content here. just a box for now -->
<a-box position='0 0.5 0' material='opacity: 0.5;'></a-box>
<!-- define a camera which will move according to the marker position -->
<a-marker-camera preset='hiro'></a-marker-camera>
</a-scene>
</body>
Wikitude SDK
• Paid SDK, for implements sophisticated AR algorithms,
available as a plugin for Native or Cordova projects
• Free trial available (for experiments and education)
• Instant Tracking, SLAM, SMART
• Built on top of ARCore and ARKit
• https://www.wikitude.com/augmented-reality-instant-tracking/
3D Assets
• https://sketchfab.com/
• https://poly.google.com/
• Create or buy 3D content to build amazing AR and VR
experiences.
Continued Study
• https://www.khanacademy.org/math/linear-algebra
• https://medium.com/@necsoft/three-js-101-hello-world-part-1-
443207b1ebe1
• https://developer.mozilla.org/en-
US/docs/Web/API/WebGL_API#Guides
• https://github.com/mozilla/aframe-xr
• https://aframe.io/blog/arjs/
Summary
• Extended Reality is of increasing interest to many industries
• Web tech can get us quite far, even with today’s experimental
APIs
• There are a number of entry points into this tech stack, pick the
right level of abstraction for you
Thank You!

More Related Content

What's hot

A-Frame: VR for Web Developers
A-Frame: VR for Web DevelopersA-Frame: VR for Web Developers
A-Frame: VR for Web Developers
Kevin Ngo
 
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
Codemotion
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
Daosheng Mu
 
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Daosheng Mu
 
Goodbye, Flatland! An introduction to React VR and what it means for web dev...
Goodbye, Flatland! An introduction to React VR  and what it means for web dev...Goodbye, Flatland! An introduction to React VR  and what it means for web dev...
Goodbye, Flatland! An introduction to React VR and what it means for web dev...
GeilDanke
 
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
Codemotion
 
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
민태 김
 
125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용NAVER D2
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's Perspective
Vin Lim
 
FiiPractic 2015 - Adroid Pro - Day 1 - UI Day
FiiPractic 2015 - Adroid Pro - Day 1 - UI DayFiiPractic 2015 - Adroid Pro - Day 1 - UI Day
FiiPractic 2015 - Adroid Pro - Day 1 - UI Day
Diaconu Andrei-Tudor
 
Machine Learning for Web Developers
Machine Learning for Web DevelopersMachine Learning for Web Developers
Machine Learning for Web Developers
Riza Fahmi
 
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
IT Event
 
Thomas Lobinger
Thomas LobingerThomas Lobinger
Thomas Lobinger
CodeFest
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side Components
Sven Wolfermann
 
Minimalism in Web Development
Minimalism in Web DevelopmentMinimalism in Web Development
Minimalism in Web Development
Jamie Matthews
 

What's hot (16)

A-Frame: VR for Web Developers
A-Frame: VR for Web DevelopersA-Frame: VR for Web Developers
A-Frame: VR for Web Developers
 
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
WebXR: Introducing Mixed Reality and the Immersive Web - Peter O'Shaughnessy ...
 
Webrender 1.0
Webrender 1.0Webrender 1.0
Webrender 1.0
 
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
 
Goodbye, Flatland! An introduction to React VR and what it means for web dev...
Goodbye, Flatland! An introduction to React VR  and what it means for web dev...Goodbye, Flatland! An introduction to React VR  and what it means for web dev...
Goodbye, Flatland! An introduction to React VR and what it means for web dev...
 
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
Mixed Realities for Web - Carsten Sandtner - Codemotion Amsterdam 2018
 
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
웹을 지탱하는 차세대 기술 @한국웹20주년 컨퍼런스
 
125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용125 고성능 web view-deview 2013 발표 자료_공유용
125 고성능 web view-deview 2013 발표 자료_공유용
 
Android Wear: A Developer's Perspective
Android Wear: A Developer's PerspectiveAndroid Wear: A Developer's Perspective
Android Wear: A Developer's Perspective
 
FiiPractic 2015 - Adroid Pro - Day 1 - UI Day
FiiPractic 2015 - Adroid Pro - Day 1 - UI DayFiiPractic 2015 - Adroid Pro - Day 1 - UI Day
FiiPractic 2015 - Adroid Pro - Day 1 - UI Day
 
Machine Learning for Web Developers
Machine Learning for Web DevelopersMachine Learning for Web Developers
Machine Learning for Web Developers
 
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
Sara Harkousse - "Web Components: It's all rainbows and unicorns! Is it?"
 
Thomas Lobinger
Thomas LobingerThomas Lobinger
Thomas Lobinger
 
RESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side ComponentsRESS – Responsive Webdesign and Server Side Components
RESS – Responsive Webdesign and Server Side Components
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
Minimalism in Web Development
Minimalism in Web DevelopmentMinimalism in Web Development
Minimalism in Web Development
 

Similar to Building AR and VR Experiences for Web Apps with JavaScript

Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017
Roland Olivier Dubois
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)
Adam Lu
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
Yottaa
 
Immersive Web
Immersive WebImmersive Web
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
Robert 'Bob' Reyes
 
Node azure
Node azureNode azure
Node azure
Emanuele DelBono
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
Raul Jimenez
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
markuskobler
 
IoT-javascript-2019-fosdem
IoT-javascript-2019-fosdemIoT-javascript-2019-fosdem
IoT-javascript-2019-fosdem
Phil www.rzr.online.fr
 
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web DesignChristopher Schmitt
 
Foundations of the Immersive Web
Foundations of the Immersive WebFoundations of the Immersive Web
Foundations of the Immersive Web
Tony Parisi
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
Matt Raible
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
Ariya Hidayat
 
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignalBuilding modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
Alessandro Pilotti
 
Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016
Tony Parisi
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
Matt Raible
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
Matt Raible
 
Byte Conf React Native 2018
Byte Conf React Native 2018Byte Conf React Native 2018
Byte Conf React Native 2018
Pulkit Kakkar
 
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるIt is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
Sadaaki HIRAI
 

Similar to Building AR and VR Experiences for Web Apps with JavaScript (20)

Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017Ferguson VR Hackathon - May 6, 2017
Ferguson VR Hackathon - May 6, 2017
 
Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)Html5 on Mobile(For Developer)
Html5 on Mobile(For Developer)
 
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
So you want to build a mobile app - HTML5 vs. Native @ the Boston Mobile Expe...
 
Immersive Web
Immersive WebImmersive Web
Immersive Web
 
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
Build (Web)VR with A-Frame (COSCUP 2019 Taipei)
 
Node azure
Node azureNode azure
Node azure
 
HTML5 WebWorks
HTML5 WebWorksHTML5 WebWorks
HTML5 WebWorks
 
Get Ahead with HTML5 on Moible
Get Ahead with HTML5 on MoibleGet Ahead with HTML5 on Moible
Get Ahead with HTML5 on Moible
 
IoT-javascript-2019-fosdem
IoT-javascript-2019-fosdemIoT-javascript-2019-fosdem
IoT-javascript-2019-fosdem
 
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignalITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
ITCamp 2012 - Alessandro Pilotti - Web API, web sockets and RSignal
 
[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design[convergese] Adaptive Images in Responsive Web Design
[convergese] Adaptive Images in Responsive Web Design
 
Foundations of the Immersive Web
Foundations of the Immersive WebFoundations of the Immersive Web
Foundations of the Immersive Web
 
Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020Front End Development for Back End Java Developers - Jfokus 2020
Front End Development for Back End Java Developers - Jfokus 2020
 
Analyzing the Performance of Mobile Web
Analyzing the Performance of Mobile WebAnalyzing the Performance of Mobile Web
Analyzing the Performance of Mobile Web
 
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignalBuilding modern web sites with ASP .Net Web API, WebSockets and RSignal
Building modern web sites with ASP .Net Web API, WebSockets and RSignal
 
Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016Introduction to WebVR Autodesk Forge 2016
Introduction to WebVR Autodesk Forge 2016
 
Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017Front End Development for Back End Developers - UberConf 2017
Front End Development for Back End Developers - UberConf 2017
 
Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017Front End Development for Back End Developers - vJUG24 2017
Front End Development for Back End Developers - vJUG24 2017
 
Byte Conf React Native 2018
Byte Conf React Native 2018Byte Conf React Native 2018
Byte Conf React Native 2018
 
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考えるIt is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
It is not HTML5. but ... / HTML5ではないサイトからHTML5を考える
 

More from FITC

Cut it up
Cut it upCut it up
Cut it up
FITC
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
FITC
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
FITC
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
FITC
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
FITC
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
FITC
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
FITC
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
FITC
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
FITC
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
FITC
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
FITC
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
FITC
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
FITC
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
FITC
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
FITC
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
FITC
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
FITC
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
FITC
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
FITC
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
FITC
 

More from FITC (20)

Cut it up
Cut it upCut it up
Cut it up
 
Designing for Digital Health
Designing for Digital HealthDesigning for Digital Health
Designing for Digital Health
 
Profiling JavaScript Performance
Profiling JavaScript PerformanceProfiling JavaScript Performance
Profiling JavaScript Performance
 
Surviving Your Tech Stack
Surviving Your Tech StackSurviving Your Tech Stack
Surviving Your Tech Stack
 
How to Pitch Your First AR Project
How to Pitch Your First AR ProjectHow to Pitch Your First AR Project
How to Pitch Your First AR Project
 
Start by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the AnswerStart by Understanding the Problem, Not by Delivering the Answer
Start by Understanding the Problem, Not by Delivering the Answer
 
Cocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s StoryCocaine to Carrots: The Art of Telling Someone Else’s Story
Cocaine to Carrots: The Art of Telling Someone Else’s Story
 
Everyday Innovation
Everyday InnovationEveryday Innovation
Everyday Innovation
 
HyperLight Websites
HyperLight WebsitesHyperLight Websites
HyperLight Websites
 
Everything is Terrifying
Everything is TerrifyingEverything is Terrifying
Everything is Terrifying
 
Post-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future HumanPost-Earth Visions: Designing for Space and the Future Human
Post-Earth Visions: Designing for Space and the Future Human
 
The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)The Rise of the Creative Social Influencer (and How to Become One)
The Rise of the Creative Social Influencer (and How to Become One)
 
East of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR GameEast of the Rockies: Developing an AR Game
East of the Rockies: Developing an AR Game
 
Creating a Proactive Healthcare System
Creating a Proactive Healthcare SystemCreating a Proactive Healthcare System
Creating a Proactive Healthcare System
 
World Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product DesignWorld Transformation: The Secret Agenda of Product Design
World Transformation: The Secret Agenda of Product Design
 
The Power of Now
The Power of NowThe Power of Now
The Power of Now
 
High Performance PWAs
High Performance PWAsHigh Performance PWAs
High Performance PWAs
 
Rise of the JAMstack
Rise of the JAMstackRise of the JAMstack
Rise of the JAMstack
 
From Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self DiscoveryFrom Closed to Open: A Journey of Self Discovery
From Closed to Open: A Journey of Self Discovery
 
Projects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time ForProjects Ain’t Nobody Got Time For
Projects Ain’t Nobody Got Time For
 

Recently uploaded

Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 

Recently uploaded (20)

Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 

Building AR and VR Experiences for Web Apps with JavaScript

  • 1. AR/VR in JavaScript Apps FITC Web Unleashed 2018
  • 2. The Rise of Extended Reality (AR/VR) • AR (Augmented Reality) – Interaction with physical realty augmented with computer generated input and output • VR (Virtual Reality) – Replace physical reality with a computer generated one • Hardware costs plummeting (Oculus Go launched F8 2018, $199) • Software for building AR and VR experiences getting better every day
  • 3.
  • 4. Introduction – Hasan Ahmad • Principal Consultant at DEV6 • Developer Circles from Facebook (Toronto) • https://dev6.com • https://www.facebook.com/groups /DeveloperCirclesToronto/ • https://twitter.com/has_ibr_ahm
  • 5. Industries that are embracing XR • Gaming • Media • Mobile Apps • Streaming • Education • Industrial • Retail
  • 6. AR/VR tech-stack for web devs • Little bit of math & physics background • Smartphone or VR headset • Three.js • WebVR API / Web XR API • A-Frame • React 360 • AR.js • 3D Content
  • 7. Three.js • https://threejs.org/ • WebGL graphics library • Scene – What to display • Camera – What to view • Renderer – How to display • Geometry – Objects, textures, etc
  • 8. $ npm install three ... import { Scene } from 'three’; const scene = new Scene(); OR <script src="https://fastcdn.org/three.js/73/three.min.js"> </script>
  • 9. var scene = new THREE.Scene(); var camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); var renderer = new THREE.WebGLRenderer(); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); var geometry = new THREE.BoxGeometry(1, 1, 1); var material = new THREE.MeshBasicMaterial({color: 0x00ff00}); var cube = new THREE.Mesh(geometry, material); scene.add(cube); camera.position.z = 5;
  • 10. WebVR • Low-level API to gather info about the VR display + capabilities • Eye parameters, the data to render the scene for each eye • Field of view data • Position of the VR display (and velocity and acceleration)
  • 11. WebXR (unstable!) • Evolution of WebVR spec • Much faster than WebVR API • Better architecture to support both VR and AR, multiple view types • Desktop • VR Headset • Smartphone • Magic Window • Touchscreen, Mouse, Gamepad, Controllers
  • 12. The future of the web is immersive (Google I/O ‘18) https://www.youtube.com/watch?v=1t1gBVykneA
  • 13. WebXR-Polyfill • Best way to make sure code written to XR spec (proposal) will actually work https://github.com/immersive-web/webxr-polyfill <script src='https://cdn.jsdelivr.net/npm/webxr- polyfill@latest/build/webxr-polyfill.js’></script> $ npm install --save webxr-polyfill
  • 14. function initXR() { xrButton = new XRDeviceButton({ onRequestSession: onRequestSession, onEndSession: onEndSession }); document.querySelector('header').appendChild(xrButton.domElement); if (navigator.xr) { navigator.xr.requestDevice().then((device) => { device.supportsSession({immersive: true}).then(() => { xrButton.setDevice(device); }); }); } } function onRequestSession(device) { device.requestSession({immersive: true}).then(onSessionStarted); }
  • 15. function onSessionStarted(session) { xrButton.setSession(session); session.addEventListener('end', onSessionEnded); gl = createWebGLContext({compatibleXRDevice: session.device}); renderer = new Renderer(gl); scene.setRenderer(renderer); session.baseLayer = new XRWebGLLayer(session, gl); session.requestFrameOfReference('eye-level').then((frameOfRef) => { xrFrameOfRef = frameOfRef; session.requestAnimationFrame(onXRFrame); }); }
  • 16. function onXRFrame(t, frame) { let session = frame.session; scene.startFrame(); session.requestAnimationFrame(onXRFrame); let pose = frame.getDevicePose(xrFrameOfRef); if (pose) { gl.bindFramebuffer(gl.FRAMEBUFFER, session.baseLayer.framebuffer); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); for (let view of frame.views) { let viewport = session.baseLayer.getViewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); scene.draw(view.projectionMatrix, pose.getViewMatrix(view)); } } else {} scene.endFrame(); }
  • 17. A-Frame • Web framework originally from Mozilla for rendering AR and VR in web pages • Declarative syntax • 3D scene graph with markup language
  • 19. <body> <a-scene> <a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box> <a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere> <a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder> <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane> <a-sky color="#ECECEC"></a-sky> </a-scene> </body>
  • 20. Loading 3D Models <a-assets> <a-asset-item id="cityModel" src="https://cdn.aframe.io/test-models/models/virtualcity/VC.gltf"> </a-asset-item> </a-assets>
  • 22. $ npm install -g react-360-cli $ react-360 init Hello360 $ cd Hello360 $ npm start React 360
  • 23. React 360 • You can use React to build VR web UIs • Render React Native components in 3D
  • 24. import { AppRegistry, StyleSheet, Text, View } from'react-360; export default class Hello360 extends React.Component { render() { return ( <View style={styles.panel}> <View style={styles.greetingBox}> <Text style={styles.greeting}> Welcome to React 360 </Text> </View> </View> ); } };
  • 25. React 360 • Similar in Architecture to React Native • Uses Web Workers to avoid single- threaded computation limitation, which could impact performance, break immersion
  • 26. React 360 • Can also load 3D models, using Entity (multiple formats) // to reference a GLTF2 model <Entity source={{gltf2: asset('myModel.gltf')}} /> // to reference an untextured OBJ model <Entity source={{obj: asset('myModel.obj')}} /> // to reference an OBJ with matching MTL file <Entity source={{obj: asset('myModel.obj'), mtl: asset('myModel.mtl')}} />
  • 27. Augmented Reality • Similar problems solved in VR • Must be able to identify real- world geometry • Capable of marker-based AR at 60fps, even on budget smartphones https://aframe.io/blog/arjs/
  • 28. Building AR with A-Frame (AR.js) <script src="https://jeromeetienne.github.io/AR.js/aframe/build/aframe-ar.js"> </script> <a-scene embedded arjs> <a-marker-camera preset='hiro'></a-marker-camera>
  • 30. Building AR with A-Frame <body style='margin : 0px; overflow: hidden;’> <a-scene embedded arjs> <!-- create your content here. just a box for now --> <a-box position='0 0.5 0' material='opacity: 0.5;'></a-box> <!-- define a camera which will move according to the marker position --> <a-marker-camera preset='hiro'></a-marker-camera> </a-scene> </body>
  • 31. Wikitude SDK • Paid SDK, for implements sophisticated AR algorithms, available as a plugin for Native or Cordova projects • Free trial available (for experiments and education) • Instant Tracking, SLAM, SMART • Built on top of ARCore and ARKit • https://www.wikitude.com/augmented-reality-instant-tracking/
  • 32. 3D Assets • https://sketchfab.com/ • https://poly.google.com/ • Create or buy 3D content to build amazing AR and VR experiences.
  • 33. Continued Study • https://www.khanacademy.org/math/linear-algebra • https://medium.com/@necsoft/three-js-101-hello-world-part-1- 443207b1ebe1 • https://developer.mozilla.org/en- US/docs/Web/API/WebGL_API#Guides • https://github.com/mozilla/aframe-xr • https://aframe.io/blog/arjs/
  • 34. Summary • Extended Reality is of increasing interest to many industries • Web tech can get us quite far, even with today’s experimental APIs • There are a number of entry points into this tech stack, pick the right level of abstraction for you

Editor's Notes

  1. AR/VR/MR/XR terms are all interchangeable In 2016, Oculus Rift (high-end experience) was about $800, the year before over $1000? Currently in the $550 range https://www.zdnet.com/article/walmart-deploys-17000-oculus-go-headsets-to-train-its-employees/
  2. Front-end training and consulting firm VoIP & chat apps for telecom (Mitel) Real-time telemetry and diagnostics apps for automotive service industry (FCA) Customized global developer platforms training (Facebook, BlackBerry) Modern search UI and experience for Ontario Electronic Land Registry (Teranet) B2B e-Commerce portal for retail giant (Adidas) DevC Toronto 1500 member community Monthly meetups, guidance, training, networking, learn about latest tech from Facebook platform
  3. https://www.zdnet.com/article/walmart-deploys-17000-oculus-go-headsets-to-train-its-employees/ Talk about each image and how it’s market is relevant
  4. We are going to walkthrough a variety of options to get started with these technologies, to get a better understanding of the state of the art in 2018. Once we understand where each tool or library is focused, hopefully we can make a decision about what is the appropriate level of detail for us How many of would consider themselves beginner web developers? How many would consider themselves to be intermediate? Expert? How many would consider themselves to be beginner AR/VR developers? How many would consider themselves to be intermediate or expert AR/VR?
  5. Core building block of many libraries in this field WebGL is too low level for web developers (shader pipeline code, GPU programming) – basically the thinnest layer possible for a browser to access the GPU directly Fun to learn about, but need to dedicate a huge chunk of time to become a computer graphics expert Need strong understanding of mathematics in computer graphics (linear algebra, geometry, some physics) Not the best use of time when you have a real web project with tight deadlines Ricardo Cabello – Mr.Doob
  6. Beware, not all the example code has been ported over to work with ES6 modules, this is an open issue on GitHub
  7. Introductory threejs code, Draws a config scene, camera, renderer, view cube Much easier to work with than dealing with low-level WebGL API
  8. Basic boilerplate and set up info to configure a VR session on a web page
  9. Handles enormous amount of boiler plate code to set up a VR session consistently across many different types of set ups
  10. https://caniuse.com/#search=webxr
  11. // Checks to see if WebXR is available and, if so, queries a list of // XRDevices that are connected to the system. // Adds a helper button to the page that indicates if any XRDevices are // available and let's the user pick between them if there's multiple. // Is WebXR available on this UA? // Request an XRDevice connected to the system. // If the device allows creation of exclusive sessions set it as the // target of the 'Enter XR' button.
  12. // Called when the user selects a device to present to. In response we // will request an exclusive session from that device. // Called when we've successfully acquired a XRSession. In response we // will set up the necessary session state and kick off the frame loop. // This informs the 'Enter XR' button that the session has started and // that it should display 'Exit XR' instead. // Listen for the sessions 'end' event so we can respond if the user // or UA ends the session for any reason. // Create a WebGL context to render with, initialized to be compatible // with the XRDisplay we're presenting to. // Create a renderer with that GL context (this is just for the samples // framework and has nothing to do with WebXR specifically.) // Set the scene's renderer, which creates the necessary GPU resources. // Use the new WebGL context to create a XRWebGLLayer and set it as the // sessions baseLayer. This allows any content rendered to the layer to // be displayed on the XRDevice. // Get a frame of reference, which is required for querying poses. In // this case an 'eye-level' frame of reference means that all poses will // be relative to the location where the XRDevice was first detected.
  13. // Per-frame scene setup. Nothing WebXR specific here. // Inform the session that we're ready for the next frame. // Get the XRDevice pose relative to the Frame of Reference we created // earlier. // Getting the pose may fail if, for example, tracking is lost. So we // have to check to make sure that we got a valid pose before attempting // to render with it. If not in this case we'll just leave the // framebuffer cleared, so tracking loss means the scene will simply // dissapear. // If we do have a valid pose, bind the WebGL layer's framebuffer, // which is where any content to be displayed on the XRDevice must be // rendered. // Clear the framebuffer // Loop through each of the views reported by the frame and draw them // into the corresponding viewport. // Draw this view of the scene. What happens in this function really // isn't all that important. What is important is that it renders // into the XRWebGLLayer's framebuffer, using the viewport into that // framebuffer reported by the current view, and using the // projection and view matricies from the current view and pose. // We bound the framebuffer and viewport up above, and are passing // in the appropriate matrices here to be used when rendering.
  14. That is a lot of code just to create a VR scene. Good to know what the API is responsible for, but if what if you just want to start building VR environments in the browser, as quickly as possible? Is ~10 LOC quick enough? This is the best place to start for 90% of web devs https://aframe.io/ Brilliant entity component framework by Mozilla, allows you to declaratively build and define a 3D VR scene with a natural HTML markup syntax Abstract a scene using entity component architecture Components and entities abstract 3d concepts like geometry, mesh, lighting, textures into single objects in a scene Can create higher level re-usable components Declaratively mark up a scene using high level re-usable components
  15. Multiple ways to install, depending on your projects build setup.
  16. Declaratively build a scene by nesting entities inside of <a-scene> Components are an entities Attributes Compose entities of each other Can extend this to a full interaction model
  17. Load huge geometry effeciently
  18. This fetches the latest version of the CLI and installs it on your system. After installation, we can use it to generate the initial code for our first project. Start by navigating to a directory where you would like to put your new project, and run the command to create a new project called Hello360. This creates a new directory called Hello360, with all of the files needed to run your project. Enter the directory to view them. During development, the bundler runs a local server that allows you to access your project. It serves up the files for your project, doing any necessary compilation or processing at request time. When you're ready to publish your project, you can instruct the bundler to build production versions of these files, so you can place them on any web server. For now, start the development server with the following command. After the first load, successive loads are much faster, even when you change your code. You can watch the progress in the terminal where you started your server, and once the app has loaded you should see something like this in your browser:
  19. Previously React VR, project has been replaced with React 360. Focused on 3D and 360 UIs, and photosphere and 360 video integration for web applications React 360 allows you to use familiar tools and concepts to create immersive 360 content on the web. Abstractions are focused on user interfaces and user interactions, rather than focus on 3D scene framework (A-Frame approach) Uses Three.js internally, but in the future will be open to working with WebGL directly
  20. Executors Executors are pieces of the runtime that run your React application in a separate process from the main browser window. React 360 ships with two different executors, but chances are good that you don't need to worry about configuring this. Web Worker Executor Web Workers are a modern browser feature that allows code to run outside of the main window context. This is ideal for high-cost operations, or in our case, running code without interrupting the requestAnimationFrame loop. By default, React 360 uses a Web Worker to execute your React code. That means that any code found in your index.js runs inside a Web Worker environment, not the standard browser window
  21. React 360 is still in VERY early stages Mininal API surface, not many built-in Components and APIs yet. Oculus native APIs are the focus for game development, React 360 has transitioned to focusing on developing Immersive 360 media for the web, which can be experienced with VR and AR equipment, but its not necessarily a requirement. Not many examples yet
  22. Windows Mixed Reality Smartphone cameras Generally understood as a bit harder to pull off a good AR experience, compared to VR This is because VR developers have 100% control of user perception. AR needs to take into account data from the real world, at human scale and time Markers allow the AR engine to determine physical space that is being viewed by the camera Algorithms adjust over time, if the expected surface “drifts” from the actual surface, markers help the AR engine correct itself
  23. Can think of like a “QR” code to activate AR display Can create custom markers as well But AR.js supports another kind of marker, called barcode. Each of those markers contains a kind of binary code which encodes a number. For example below, you see one representing 5
  24. While the tech is not quite mature, the capabilities of the existing tech is quite impressive The more time you spend working with AR and VR features, the more you start to feel like this is going to be the future for a lot of industries
  25. Time for questions?