SlideShare a Scribd company logo
1 of 64
Download to read offline
WebGL / Three.js Workshop
at Futurejs 2014
Ross McKegney
& Carlos Sanchez
@verold
Agenda:
9:00 Introduction & Basics of Three.js
10:00 Adding 3D content to your web app
11:15 Three.js and the Internet of Things
12:45 Wrap up
Gaming & Web are converging
Gaming & Web are converging
This era of the web belongs to creative coders
Graphics WebGL
Processing WebCL / Workers / Emscripten
Audio Web Audio
Networking WebRTC
Real-time + Devices Web Sockets
This is for you!
The web is evolving, and it will reshape
game development AND web design
Three.js
Global Arms Trade Dataviz
by Google
Small arms trade data from 1992-2010 is
visualized on an interactive 3D globe.
Journey to Middle Earth
by North Kingdom
An interactive tour of Middle Earth for desktop
and mobile, using WebGL and HTML5.
HexGL
by Thibaut Despoutin
A simple racing game built for the web using
Three.js.
MODULE 1:
Getting Started with Three.js
http://threejs.org/docs/index.html
Three.js starts with:
● Scene
● Renderer (we’ll always use WebGL)
● Camera, Objects, Materials, Lights
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.CubeGeometry(1,1,1);
var material = new THREE.MeshBasicMaterial(
{ color: 0x00ff00, wireframe: true } );
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );
camera.position.z = 5;
function render() {
requestAnimationFrame(render);
renderer.render(scene, camera);
cube.rotation.x += 0.01;
cube.position.z += 0.01;
}
render(); http://codepen.io/rossmckegney/full/lcAta
Tweak 1: Materials
Three.js comes with a number of built-in
materials and shaders: Basic, Lambert,
Phong.
MeshLambertMaterial
For non-shiny materials, lit per vertex
var geometry = new THREE.CubeGeometry(1,1,1);
var material = new THREE.MeshLambertMaterial(
{ ambient: 'blue' } );
var cube = new THREE.Mesh( geometry, material );
cube.overdraw = true;
scene.add( cube );
var ambientLight = new THREE.AmbientLight('white');
scene.add(ambientLight);
http://codepen.io/rossmckegney/full/DaohB
MeshPhongMaterial
For shiny materials, lit per pixel
var geometry = new THREE.CubeGeometry(1,1,1);
var material = new THREE.MeshPhongMaterial(
{ color: 'blue' } );
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );
var directionalLight = new THREE.DirectionalLight( 'white', 0.5 );
directionalLight.position.set( 0, 0, 1 );
scene.add( directionalLight );
http://codepen.io/rossmckegney/full/lkwnI
Tweak 2: Load model
Three.js comes with loaders for JSON,
OBJ, Collada, STL, etc
THREE.OBJLoader
Three.js extension, allows to load an OBJ
file. Load the mesh and texture, with
progress reporting. Watch out for CORS.
var manager = new THREE.LoadingManager();
manager.onProgress = function ( item, loaded, total ) {
console.log( item, loaded, total );
};
var texture = new THREE.Texture();
var loader = new THREE.ImageLoader( manager );
loader.load( 'textures/UV_Grid_Sm.jpg', function ( image ) {
texture.image = image;
texture.needsUpdate = true;
} );
var loader = new THREE.OBJLoader( manager );
loader.load( 'obj/male02.obj', function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material.map = texture;
}
} );
object.position.y = -90;
scene.add( object );
} );
MODULE 2:
Overview of Verold Studio
Let’s be clear:
Three.js is an easy-to-use graphics library
supported by a large community of
developers. It is not a game engine.
So, we built an open-source game engine
extending Three.js!
● Component Entity Model
● Assisted Loading
● Mobile Support and Fallbacks
Component Entity Model
Game logic is defined as modular
components that can be attached to nodes
on the scene graph.
Component Entity Model
Scene Graph
The scene graph holds
your models, lights,
cameras, etc
Component Entity Model
Scene Graph
Behaviours are defined
by attaching modular
components to nodes in
the scene graph
Component Entity Model
Demo: Let’s light and rotate a cube!
Assisted Loading
In a game engine (especially for the web)
you need fine-grained control over loading
Assisted Loading
You might load everything upfront
(loading bar), or defer loading. We need a
way to trigger asset/object loading and
bind to different stages of load.
Assisted Loading
Demo: Loading scenarios
Mobile Support & Fallbacks
Ideally, HTML5 is write once, run
anywhere. Not true in practice.
Mobile Support & Fallbacks
Device constraints:
● CPU & rendering performance
● GPU capabilities
● Network bandwidth
Mobile Support & Fallbacks
Demo: Thooloo.com
MODULE 3:
Adding 3D to your website
Animated Hero Image
Great way to bring
your homepage to life!
http://verold.com
Product Configurators
You can easily swap
geometries, change lighting,
materials, etc..
http://vrld.co/ogUzZk
3D Scans
Useful not only for
modelled 3D, but also
for 3D scans.
http://www.juanvilla.es
http://bossfight.me
Plays well with others!
Three.js and Verold work
nicely for simple demos,
or can be scaled up to
robust frameworks like
Angular.js
http://brained.io
Offline too!
Web can be used offline
or online. e.g. BPush kiosk
by James White designs.
http://ibptouch.dyndns.org/?range=26
And of course games :)
The Verold engine is
well suited to simple
games, seamlessly
integrated with your
website.
http://thooloo.com
OK… so let’s add some 3D to a page!
The goal for this exercise is to walk you
through adding a 3D model to a canvas on
your web app.
Steps:
1. Upload 3D model
2. Setup scene and materials
3. Create your responsive web app
4. Load the Verold engine and model
5. Setup controls and widgets
MODULE 4:
Verold and the Internet of Things
IoT -> Web
External
Device
Native
Handler
bluetooth
Node.js
Emitter
socket
Web Browser
Web App
web socket
Web Server
e.g.
NeuroSky
Oculus VR
Raspberry Pi
Leap Motion
...
Desktop
ex. Node-Neurosky
Connecting to Neurosky:
this.port = opts.port || 13854
this.host = opts.host || 'localhost'
if(typeof(opts.appName) !== 'string') throw new NodeNeuroSkyError('Must specify appName')
if(typeof(opts.appKey) !== 'string') throw new NodeNeuroSkyError('Must specify appKey')
this.auth = {
appName:opts.appName,
appKey:opts.appKey
}
this.config = {
enableRawOutput: false,
format: "Json"
}
events.EventEmitter.call(this)
Listening:
NeuroSkyClient.prototype.connect = function(){
...
client.on('data',function(data){
if(!self.configSent){
self.configSent = true
client.write(JSON.stringify(self.config))
} else {
try{
self.emit('data',JSON.parse(data.toString()))
}catch(e){
self.emit('parse_error',data.toString())
}
}
})
Emitting:
var express = require(‘express’), app = express(), server = require(‘http’).createServer(app),
io = require(‘socket.io’).listen(server, {log:false}),
nodeThinkGear = require(‘../node-thinkgear’), mySocket = undefined;
…
var tgClient = nodeThinkGear.createClient({ appName: ‘NodeThinkGear’, appKey: ‘xxx’ });
tgClient.connect();
io.sockets.on(‘connection’, function (socket) { mySocket = socket; });
tgClient.on(‘data, function(data) {
if (data[‘poorSignalLevel’]) {
console.log(“connecting…”);
}
if (mySocket) {
mySocket.emit(‘think’, {data: data});
}
});
JS Client:
var socket = io.connect(‘http://localhost:3000’);
socket.on(‘think’, function(data) {
if (data[‘data’] && data[‘data’][‘eSense’]) {
attention = data[‘data’[‘eSense’][‘attention’];
meditation = data[‘data’[‘eSense’][meditation];
}
}
Exercise: Leap Motion and Three.js
Let’s integrate 3D gestures with our 3D scene!
Download the Leap Motion client app
https://www.leapmotion.com/setup
Get LeapJS
Learn more about LeapJS at https://developer.
leapmotion.com/leapjs/welcome
Verold Leap Template
Grab the Verold Leap Template at
http://studio.verold.com/projects/5357f75685ce9f0200000058
VeroldController Component
Attach this to your Scene, and then it will
establish a connection to Leap and pass the
connection as the ‘leapReady’ event.
// Connect to Leap
var leap = new Leap.Controller({host: 'localhost', port: 6437});
leap.connect();
// This allows us to maintain the connection even whilst in an iFrame.
leap.setBackground(true);
// Pass the leap controller to all listeners
this.events.trigger("leapReady", leap);
VeroldListener Component
Sample component to show you how to listen to
Leap events from the LeapController.
Component.prototype.init = function() {
this.listenTo(this.events, "leapReady", this.initLeap);
};
Component.prototype.initLeap = function(leap) {
this.leap = leap;
};
Do Leap things!!!
LeapFrame = {
hands: [
{
palmPosition: [x,y,z]
palmNormal: [x,y,z]
direction: [x,y,z]
roll()
pitch()
yaw()
fingers: [
{
tipPosition: [x,y,z]
direction: [x,y,z]
}
]
}
]
}
What will you make?
COMMUNICATE IN 3D
Ross McKegney, CEO
ross.mckegney@verold.com
Carlos Sanchez, Senior Web Designer
carlos@verold.com

More Related Content

What's hot

Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Ontico
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]JavaScript Meetup HCMC
 
Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004Seonki Paik
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...iMasters
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRCodemotion
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGLTony Parisi
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.jsJosh Staples
 
Augmented Reality in JavaScript
Augmented Reality in JavaScriptAugmented Reality in JavaScript
Augmented Reality in JavaScriptZeno Rocha
 
JS Experience 2017 - Animações simples com o three.js
JS Experience 2017 - Animações simples com o three.jsJS Experience 2017 - Animações simples com o three.js
JS Experience 2017 - Animações simples com o three.jsiMasters
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptChanghwan Yi
 
Using babylon js to create apps & games for all web gl devices
Using babylon js to create apps & games for all web gl devicesUsing babylon js to create apps & games for all web gl devices
Using babylon js to create apps & games for all web gl devicesDavid Catuhe
 
Rethink Async With RXJS
Rethink Async With RXJSRethink Async With RXJS
Rethink Async With RXJSRyan Anklam
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Nodepdeschen
 

What's hot (20)

Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
 
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
3D Web Programming [Thanh Loc Vo , CTO Epsilon Mobile ]
 
Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004
 
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
[JS EXPERIENCE 2018] Jogos em JavaScript com WebGL - Juliana Negreiros, Codem...
 
The next frontier: WebGL and WebVR
The next frontier: WebGL and WebVRThe next frontier: WebGL and WebVR
The next frontier: WebGL and WebVR
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGL
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.js
 
Augmented Reality in JavaScript
Augmented Reality in JavaScriptAugmented Reality in JavaScript
Augmented Reality in JavaScript
 
JS Experience 2017 - Animações simples com o three.js
JS Experience 2017 - Animações simples com o three.jsJS Experience 2017 - Animações simples com o three.js
JS Experience 2017 - Animações simples com o three.js
 
W3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascriptW3C HTML5 KIG-How to write low garbage real-time javascript
W3C HTML5 KIG-How to write low garbage real-time javascript
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
 
Using babylon js to create apps & games for all web gl devices
Using babylon js to create apps & games for all web gl devicesUsing babylon js to create apps & games for all web gl devices
Using babylon js to create apps & games for all web gl devices
 
The jsdom
The jsdomThe jsdom
The jsdom
 
HTML5 video filters
HTML5 video filtersHTML5 video filters
HTML5 video filters
 
The State of JavaScript
The State of JavaScriptThe State of JavaScript
The State of JavaScript
 
Rethink Async With RXJS
Rethink Async With RXJSRethink Async With RXJS
Rethink Async With RXJS
 
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip  with a Webcam, a GSP and Some Fun with NodeHow to Hack a Road Trip  with a Webcam, a GSP and Some Fun with Node
How to Hack a Road Trip with a Webcam, a GSP and Some Fun with Node
 
HTML5 Canvas
HTML5 CanvasHTML5 Canvas
HTML5 Canvas
 

Viewers also liked

Starting Development for Nokia N9
Starting Development for Nokia N9Starting Development for Nokia N9
Starting Development for Nokia N9tpyssysa
 
Qt Design Patterns
Qt Design PatternsQt Design Patterns
Qt Design PatternsYnon Perek
 
Qt State Machine Framework
Qt State Machine FrameworkQt State Machine Framework
Qt State Machine Frameworkaccount inactive
 
Cutest technology of them all - Forum Nokia Qt Webinar December 2009
Cutest technology of them all - Forum Nokia Qt Webinar December 2009Cutest technology of them all - Forum Nokia Qt Webinar December 2009
Cutest technology of them all - Forum Nokia Qt Webinar December 2009Nokia
 
Introduction to WebGL and Three.js
Introduction to WebGL and Three.jsIntroduction to WebGL and Three.js
Introduction to WebGL and Three.jsJames Williams
 
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIICS
 
Best Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part IIBest Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part IIICS
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Andreas Jakl
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IICS
 
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVBest Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVICS
 
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...The Anatomy of Real World Apps - Dissecting cross-platform apps written using...
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...Marius Bugge Monsen
 
WebGL and Three.js
WebGL and Three.jsWebGL and Three.js
WebGL and Three.jsyomotsu
 
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...vtunotesbysree
 

Viewers also liked (16)

Starting Development for Nokia N9
Starting Development for Nokia N9Starting Development for Nokia N9
Starting Development for Nokia N9
 
Qt Design Patterns
Qt Design PatternsQt Design Patterns
Qt Design Patterns
 
Qt Workshop
Qt WorkshopQt Workshop
Qt Workshop
 
Qt State Machine Framework
Qt State Machine FrameworkQt State Machine Framework
Qt State Machine Framework
 
Cutest technology of them all - Forum Nokia Qt Webinar December 2009
Cutest technology of them all - Forum Nokia Qt Webinar December 2009Cutest technology of them all - Forum Nokia Qt Webinar December 2009
Cutest technology of them all - Forum Nokia Qt Webinar December 2009
 
Qt 5 - C++ and Widgets
Qt 5 - C++ and WidgetsQt 5 - C++ and Widgets
Qt 5 - C++ and Widgets
 
Introduction to WebGL and Three.js
Introduction to WebGL and Three.jsIntroduction to WebGL and Three.js
Introduction to WebGL and Three.js
 
Introduction to Qt
Introduction to QtIntroduction to Qt
Introduction to Qt
 
Best Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part IIIBest Practices in Qt Quick/QML - Part III
Best Practices in Qt Quick/QML - Part III
 
Best Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part IIBest Practices in Qt Quick/QML - Part II
Best Practices in Qt Quick/QML - Part II
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
Best Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part IBest Practices in Qt Quick/QML - Part I
Best Practices in Qt Quick/QML - Part I
 
Best Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IVBest Practices in Qt Quick/QML - Part IV
Best Practices in Qt Quick/QML - Part IV
 
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...The Anatomy of Real World Apps - Dissecting cross-platform apps written using...
The Anatomy of Real World Apps - Dissecting cross-platform apps written using...
 
WebGL and Three.js
WebGL and Three.jsWebGL and Three.js
WebGL and Three.js
 
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
SOLUTION MANUAL OF OPERATING SYSTEM CONCEPTS BY ABRAHAM SILBERSCHATZ, PETER B...
 

Similar to From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014

Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineRicardo Silva
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSphilogb
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datosphilogb
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScriptersgerbille
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyDavid Padbury
 
Migrating your Web app to Virtual Reality
Migrating your Web app to Virtual RealityMigrating your Web app to Virtual Reality
Migrating your Web app to Virtual RealityDenis Radin
 
Augmented reality in web rtc browser
Augmented reality in web rtc browserAugmented reality in web rtc browser
Augmented reality in web rtc browserALTANAI BISHT
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Christian Heilmann
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applicationsTom Croucher
 
Average- An android project
Average- An android projectAverage- An android project
Average- An android projectIpsit Dash
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaExoLeaders.com
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLgerbille
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO TimeTony Parisi
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.jsJeongHun Byeon
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gearsdion
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript EverywherePascal Rettig
 

Similar to From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014 (20)

Event-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 EngineEvent-driven IO server-side JavaScript environment based on V8 Engine
Event-driven IO server-side JavaScript environment based on V8 Engine
 
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJSJavaScript para Graficos y Visualizacion de Datos - BogotaJS
JavaScript para Graficos y Visualizacion de Datos - BogotaJS
 
JavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de DatosJavaScript para Graficos y Visualizacion de Datos
JavaScript para Graficos y Visualizacion de Datos
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 
HTML5 for the Silverlight Guy
HTML5 for the Silverlight GuyHTML5 for the Silverlight Guy
HTML5 for the Silverlight Guy
 
Migrating your Web app to Virtual Reality
Migrating your Web app to Virtual RealityMigrating your Web app to Virtual Reality
Migrating your Web app to Virtual Reality
 
Augmented reality in web rtc browser
Augmented reality in web rtc browserAugmented reality in web rtc browser
Augmented reality in web rtc browser
 
huhu
huhuhuhu
huhu
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010Using YQL Sensibly - YUIConf 2010
Using YQL Sensibly - YUIConf 2010
 
Writing robust Node.js applications
Writing robust Node.js applicationsWriting robust Node.js applications
Writing robust Node.js applications
 
Average- An android project
Average- An android projectAverage- An android project
Average- An android project
 
Good karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with KarmaGood karma: UX Patterns and Unit Testing in Angular with Karma
Good karma: UX Patterns and Unit Testing in Angular with Karma
 
NodeJS
NodeJSNodeJS
NodeJS
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO Time
 
soft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.jssoft-shake.ch - Hands on Node.js
soft-shake.ch - Hands on Node.js
 
Introducing to node.js
Introducing to node.jsIntroducing to node.js
Introducing to node.js
 
Future of Web Apps: Google Gears
Future of Web Apps: Google GearsFuture of Web Apps: Google Gears
Future of Web Apps: Google Gears
 
Javascript Everywhere
Javascript EverywhereJavascript Everywhere
Javascript Everywhere
 

Recently uploaded

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 

Recently uploaded (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 

From Hello World to the Interactive Web with Three.js: Workshop at FutureJS 2014

  • 1. WebGL / Three.js Workshop at Futurejs 2014 Ross McKegney & Carlos Sanchez @verold
  • 2. Agenda: 9:00 Introduction & Basics of Three.js 10:00 Adding 3D content to your web app 11:15 Three.js and the Internet of Things 12:45 Wrap up
  • 3. Gaming & Web are converging
  • 4. Gaming & Web are converging This era of the web belongs to creative coders
  • 5.
  • 6.
  • 7.
  • 8. Graphics WebGL Processing WebCL / Workers / Emscripten Audio Web Audio Networking WebRTC Real-time + Devices Web Sockets
  • 9.
  • 10. This is for you! The web is evolving, and it will reshape game development AND web design
  • 11.
  • 12.
  • 14. Global Arms Trade Dataviz by Google Small arms trade data from 1992-2010 is visualized on an interactive 3D globe.
  • 15. Journey to Middle Earth by North Kingdom An interactive tour of Middle Earth for desktop and mobile, using WebGL and HTML5.
  • 16. HexGL by Thibaut Despoutin A simple racing game built for the web using Three.js.
  • 17. MODULE 1: Getting Started with Three.js http://threejs.org/docs/index.html
  • 18. Three.js starts with: ● Scene ● Renderer (we’ll always use WebGL) ● Camera, Objects, Materials, Lights
  • 19. 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.CubeGeometry(1,1,1); var material = new THREE.MeshBasicMaterial( { color: 0x00ff00, wireframe: true } ); var cube = new THREE.Mesh( geometry, material ); scene.add( cube ); camera.position.z = 5; function render() { requestAnimationFrame(render); renderer.render(scene, camera); cube.rotation.x += 0.01; cube.position.z += 0.01; } render(); http://codepen.io/rossmckegney/full/lcAta
  • 20. Tweak 1: Materials Three.js comes with a number of built-in materials and shaders: Basic, Lambert, Phong.
  • 21. MeshLambertMaterial For non-shiny materials, lit per vertex var geometry = new THREE.CubeGeometry(1,1,1); var material = new THREE.MeshLambertMaterial( { ambient: 'blue' } ); var cube = new THREE.Mesh( geometry, material ); cube.overdraw = true; scene.add( cube ); var ambientLight = new THREE.AmbientLight('white'); scene.add(ambientLight); http://codepen.io/rossmckegney/full/DaohB
  • 22. MeshPhongMaterial For shiny materials, lit per pixel var geometry = new THREE.CubeGeometry(1,1,1); var material = new THREE.MeshPhongMaterial( { color: 'blue' } ); var cube = new THREE.Mesh( geometry, material ); scene.add( cube ); var directionalLight = new THREE.DirectionalLight( 'white', 0.5 ); directionalLight.position.set( 0, 0, 1 ); scene.add( directionalLight ); http://codepen.io/rossmckegney/full/lkwnI
  • 23. Tweak 2: Load model Three.js comes with loaders for JSON, OBJ, Collada, STL, etc
  • 24. THREE.OBJLoader Three.js extension, allows to load an OBJ file. Load the mesh and texture, with progress reporting. Watch out for CORS.
  • 25. var manager = new THREE.LoadingManager(); manager.onProgress = function ( item, loaded, total ) { console.log( item, loaded, total ); }; var texture = new THREE.Texture(); var loader = new THREE.ImageLoader( manager ); loader.load( 'textures/UV_Grid_Sm.jpg', function ( image ) { texture.image = image; texture.needsUpdate = true; } ); var loader = new THREE.OBJLoader( manager ); loader.load( 'obj/male02.obj', function ( object ) { object.traverse( function ( child ) { if ( child instanceof THREE.Mesh ) { child.material.map = texture; } } ); object.position.y = -90; scene.add( object ); } );
  • 26. MODULE 2: Overview of Verold Studio
  • 27.
  • 28. Let’s be clear: Three.js is an easy-to-use graphics library supported by a large community of developers. It is not a game engine.
  • 29. So, we built an open-source game engine extending Three.js! ● Component Entity Model ● Assisted Loading ● Mobile Support and Fallbacks
  • 30. Component Entity Model Game logic is defined as modular components that can be attached to nodes on the scene graph.
  • 31. Component Entity Model Scene Graph The scene graph holds your models, lights, cameras, etc
  • 32. Component Entity Model Scene Graph Behaviours are defined by attaching modular components to nodes in the scene graph
  • 33. Component Entity Model Demo: Let’s light and rotate a cube!
  • 34. Assisted Loading In a game engine (especially for the web) you need fine-grained control over loading
  • 35. Assisted Loading You might load everything upfront (loading bar), or defer loading. We need a way to trigger asset/object loading and bind to different stages of load.
  • 37. Mobile Support & Fallbacks Ideally, HTML5 is write once, run anywhere. Not true in practice.
  • 38. Mobile Support & Fallbacks Device constraints: ● CPU & rendering performance ● GPU capabilities ● Network bandwidth
  • 39. Mobile Support & Fallbacks Demo: Thooloo.com
  • 40. MODULE 3: Adding 3D to your website
  • 41. Animated Hero Image Great way to bring your homepage to life! http://verold.com
  • 42. Product Configurators You can easily swap geometries, change lighting, materials, etc.. http://vrld.co/ogUzZk
  • 43. 3D Scans Useful not only for modelled 3D, but also for 3D scans. http://www.juanvilla.es http://bossfight.me
  • 44. Plays well with others! Three.js and Verold work nicely for simple demos, or can be scaled up to robust frameworks like Angular.js http://brained.io
  • 45. Offline too! Web can be used offline or online. e.g. BPush kiosk by James White designs. http://ibptouch.dyndns.org/?range=26
  • 46. And of course games :) The Verold engine is well suited to simple games, seamlessly integrated with your website. http://thooloo.com
  • 47. OK… so let’s add some 3D to a page! The goal for this exercise is to walk you through adding a 3D model to a canvas on your web app.
  • 48. Steps: 1. Upload 3D model 2. Setup scene and materials 3. Create your responsive web app 4. Load the Verold engine and model 5. Setup controls and widgets
  • 49. MODULE 4: Verold and the Internet of Things
  • 50. IoT -> Web External Device Native Handler bluetooth Node.js Emitter socket Web Browser Web App web socket Web Server e.g. NeuroSky Oculus VR Raspberry Pi Leap Motion ... Desktop
  • 52. Connecting to Neurosky: this.port = opts.port || 13854 this.host = opts.host || 'localhost' if(typeof(opts.appName) !== 'string') throw new NodeNeuroSkyError('Must specify appName') if(typeof(opts.appKey) !== 'string') throw new NodeNeuroSkyError('Must specify appKey') this.auth = { appName:opts.appName, appKey:opts.appKey } this.config = { enableRawOutput: false, format: "Json" } events.EventEmitter.call(this)
  • 53. Listening: NeuroSkyClient.prototype.connect = function(){ ... client.on('data',function(data){ if(!self.configSent){ self.configSent = true client.write(JSON.stringify(self.config)) } else { try{ self.emit('data',JSON.parse(data.toString())) }catch(e){ self.emit('parse_error',data.toString()) } } })
  • 54. Emitting: var express = require(‘express’), app = express(), server = require(‘http’).createServer(app), io = require(‘socket.io’).listen(server, {log:false}), nodeThinkGear = require(‘../node-thinkgear’), mySocket = undefined; … var tgClient = nodeThinkGear.createClient({ appName: ‘NodeThinkGear’, appKey: ‘xxx’ }); tgClient.connect(); io.sockets.on(‘connection’, function (socket) { mySocket = socket; }); tgClient.on(‘data, function(data) { if (data[‘poorSignalLevel’]) { console.log(“connecting…”); } if (mySocket) { mySocket.emit(‘think’, {data: data}); } });
  • 55. JS Client: var socket = io.connect(‘http://localhost:3000’); socket.on(‘think’, function(data) { if (data[‘data’] && data[‘data’][‘eSense’]) { attention = data[‘data’[‘eSense’][‘attention’]; meditation = data[‘data’[‘eSense’][meditation]; } }
  • 56. Exercise: Leap Motion and Three.js Let’s integrate 3D gestures with our 3D scene!
  • 57. Download the Leap Motion client app https://www.leapmotion.com/setup
  • 58. Get LeapJS Learn more about LeapJS at https://developer. leapmotion.com/leapjs/welcome
  • 59. Verold Leap Template Grab the Verold Leap Template at http://studio.verold.com/projects/5357f75685ce9f0200000058
  • 60. VeroldController Component Attach this to your Scene, and then it will establish a connection to Leap and pass the connection as the ‘leapReady’ event. // Connect to Leap var leap = new Leap.Controller({host: 'localhost', port: 6437}); leap.connect(); // This allows us to maintain the connection even whilst in an iFrame. leap.setBackground(true); // Pass the leap controller to all listeners this.events.trigger("leapReady", leap);
  • 61. VeroldListener Component Sample component to show you how to listen to Leap events from the LeapController. Component.prototype.init = function() { this.listenTo(this.events, "leapReady", this.initLeap); }; Component.prototype.initLeap = function(leap) { this.leap = leap; };
  • 62. Do Leap things!!! LeapFrame = { hands: [ { palmPosition: [x,y,z] palmNormal: [x,y,z] direction: [x,y,z] roll() pitch() yaw() fingers: [ { tipPosition: [x,y,z] direction: [x,y,z] } ] } ] }
  • 63. What will you make?
  • 64. COMMUNICATE IN 3D Ross McKegney, CEO ross.mckegney@verold.com Carlos Sanchez, Senior Web Designer carlos@verold.com