SlideShare uma empresa Scribd logo
1 de 38
Baixar para ler offline
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 1/38
Creating Applications with WebGL and Three.js
+James Williams @ecspike
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 2/38
About Me
Author of Learning HTML5 Game Programming
Writing a new book on Three.js
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 3/38
Learning HTML5 Game Programming
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 4/38
Agenda
What is WebGL/Three.js?
Creating Meshes
Lighting and Shading
Working with Physics Engines
Demos
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 5/38
What is WebGL?
Low-level 3D graphics context
Uses canvas tag
Hardware-accelerated
Syntax based on OpenGL ES 2.0
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 6/38
Why aren't we using raw WebGL?
Higher barrier to entry
Lots of code
Requires directly managing data structures
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 7/38
What is Three.js?
3D scenegraph library
Abstracts the nastiness away from WebGL
Renders to Canvas 2D, WebGL, SVG
Can animate HTML elements using CSS3
Can import models from popular 3D modeling apps
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 8/38
Creating a basic app
Scene
Camera
Renderer
Lighting (optional)
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 9/38
Camera
Eye Point
Field of Vision
Near/Far Planes
Target (LookAt) Point
Up Vector
camera = new THREE.PerspectiveCamera(FOV, ASPECT, NEAR, FAR, [target]);
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 10/38
A Basic Scene
@renderer = new THREE.WebGLRenderer({autoClear:true})
@renderer.setClearColor(new THREE.Color(0x000000))
@renderer.setSize(width, height)
@camera = new THREE.PerspectiveCamera(fov, aspect, near, far)
@camera.position.z = 100
@scene = new THREE.Scene()
$('#container').empty()
$("#container").get(0).appendChild(@renderer.domElement)
@scene.add(@camera)
# truncated
@renderer.render(@scene, @camera)
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 11/38
Creating Meshes
new THREE.Mesh(new CubeGeometry(100,1,100),
new THREE.MeshBasicMaterial({color: 0xFF0000}))
Built-in Geometries
SphereGeometry
PlaneGeometry
CylinderGeometry
CubeGeometry
TextGeometry
and several others
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 12/38
Materials
# Basic Material
new THREE.MeshBasicMaterial({color: 0xFFFFFF})
# Per-vertex coloring
f = triGeometry.faces[0]
f.vertexColors[0] = vColors[0]
f.vertexColors[1] = vColors[1]
f.vertexColors[2] = vColors[2]
triMaterial = new THREE.MeshBasicMaterial(
{color: 0xFFFFFF, vertexColors:THREE.VertexColors}
)
# Phong, Lambert, Face, Line, etc
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 13/38
Demo
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 14/38
Loading Models
Blender
Collada
OBJ
MAX
Maya
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 15/38
Loading A Model
@models = {}
loader = new THREE.JSONLoader()
loader.load('/models/hero.js', @heroCallback)
heroCallback: (g, m) ->
obj = new THREE.Mesh(g, new THREE.MeshFaceMaterial(m))
obj.rotation.x = -1.57
obj.position.y = 100
obj.scale.set(6,6,6)
app.hero = obj
app.scene.add(app.hero)
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 16/38
Loading A Scene
loader = new THREE.SceneLoader()
loader.callbackProgress = @callbackProgress
loader.load( "scripts/scenes/falling-ball.js", self.callbackFinished)
# Receives updates from loader
callbackProgress: (progress, result) ->
console.log result
console.log progress
# Called when finished loading
callbackFinished: (result) ->
app.scene = result.scene
app.camera = result.cameras.Camera
app.camera.lookAt(new THREE.Vector3(0,0,0))
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 17/38
Three.js Editor
Create primitive objects
Add materials
Export objects or scenes
http://threejs.org/editor
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 18/38
Demo
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 19/38
What is GLSL?
Targets the GPU and graphics pipeline
High level language with C-like syntax
Passed around as strings
Can be generated and compiled at run-time
Referred to as programs (the combination of a vertex and fragment shader)
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 20/38
Vertex Shaders
Run once per vertex in a mesh
Can alter color, position, or texture coordinates
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 21/38
Example vertex shader
<script id="shader-vs" type="x-shader/x-vertex">
#ifdef GL_ES
precision highp float;
#endif
void main(void) {
gl_Position = projectionMatrix * modelViewMatrix * vec4(position,
1.0);
}
</script>
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 22/38
Frament(Pixel) Shaders
Run on every pixel in a mesh
Can produce effects such as bump mapping and shadowing
Only knows* about the pixel it is working on
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 23/38
Example fragment shader
<script id="shader-vs" type="x-shader/x-vertex">
#ifdef GL_ES
precision highp float;
#endif
void main(void) {
gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);
}
</script>
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 24/38
Cel (Toon) Shading
uniform vec3 diffuse;
//from http://www.neocomputer.org/projects/donut
gl_FragColor = vec4(diffuse, 1.0);
vec3 basecolor=vec3(gl_FragColor[0], gl_FragColor[1], gl_FragColor[2]);
float alpha = gl_FragColor[3];
float vlf = vLightFront[0];
// Clean and simple //
if (vlf< 0.50) {
gl_FragColor = vec4(mix( basecolor, vec3(0.0), 0.5), alpha); }
if (vlf>=0.50) {
gl_FragColor = vec4(mix( basecolor, vec3(0.0), 0.3), alpha); }
if (vlf>=0.75) {
gl_FragColor = vec4(mix( basecolor, vec3(1.0), 0.0), alpha); }
//if (vlf>=0.95) {
// gl_FragColor = vec4(mix( basecolor, vec3(1.0), 0.3), alpha); }
// gl_FragColor.xyz *= vLightFront;
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 25/38
Shader Toy
Website enabling you to play around with GLSL shaders
http://www.iquilezles.org/apps/shadertoy/
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 26/38
Demo
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 27/38
Collision Detection
Bounding Box
Bounding Sphere
Rays
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 28/38
Physics using Physijs
Integrates deeply with Three.js
Built upon ammo.js
https://github.com/chandlerprall/Physijs
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 29/38
Sample Physijs Scene
# setup Physi
Physijs.scripts.worker = 'scripts/vendor/physijs/physijs_worker.js'
Physijs.scripts.ammo = 'ammo.js'
@scene = new Physijs.Scene()
@scene.setGravity new THREE.Vector3( 0, -30, 0 )
obj = new Physijs.Mesh(rawMesh.geometry, material, mass)
render: () ->
@scene.simulate()
@renderer.render(@scene, @camera)
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 30/38
Demo
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 31/38
Creating A Simple Game
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 32/38
My First Computer
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 33/38
My First Computer Game
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 34/38
Demos
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 35/38
WebGL Inspector
Allows you to incrementally step through rendering
View texture assets and GLSL programs
Permits capturing individual frames
Can be embedded or installed as a Chrome/Webkit extension
Github: http://benvanik.github.com/WebGL-Inspector/
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 36/38
Questions ?
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 37/38
Links and Sources
Adam II photo: http://www.digibarn.com/collections/systems/coleco-
adam/CIMG3282.JPG
Buck Rogers photo: http://telebunny.net/toastyblog/wp-
content/uploads/2012/08/gsj12-buckrogers2.gif
6/17/2014 Getting started with WebGL and Three.js
file:///Users/james/Downloads/3js-2013/index.html#1 38/38

Mais conteúdo relacionado

Mais procurados

Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004Seonki Paik
 
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
 
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Ontico
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGLTony Parisi
 
[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
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?Ankara JUG
 
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
 
Augmented Reality in JavaScript
Augmented Reality in JavaScriptAugmented Reality in JavaScript
Augmented Reality in JavaScriptZeno Rocha
 
Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012philogb
 
A Novice's Guide to WebGL
A Novice's Guide to WebGLA Novice's Guide to WebGL
A Novice's Guide to WebGLKrzysztof Kula
 
Rethink Async With RXJS
Rethink Async With RXJSRethink Async With RXJS
Rethink Async With RXJSRyan Anklam
 
Full Stack 2019 edition
Full Stack 2019 editionFull Stack 2019 edition
Full Stack 2019 editionMatjaž Lipuš
 
Jeroen Vloothuis Bend Kss To Your Will
Jeroen Vloothuis   Bend Kss To Your WillJeroen Vloothuis   Bend Kss To Your Will
Jeroen Vloothuis Bend Kss To Your WillVincenzo Barone
 
Будь первым
Будь первымБудь первым
Будь первымFDConf
 
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
 

Mais procurados (20)

Bs webgl소모임004
Bs webgl소모임004Bs webgl소모임004
Bs webgl소모임004
 
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 ]
 
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
Портируем существующее Web-приложение в виртуальную реальность / Денис Радин ...
 
Developing Web Graphics with WebGL
Developing Web Graphics with WebGLDeveloping Web Graphics with WebGL
Developing Web Graphics with WebGL
 
[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...
 
Intro
IntroIntro
Intro
 
HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?HTML5 - Daha Flash bir web?
HTML5 - Daha Flash bir web?
 
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
 
A More Flash Like Web?
A More Flash Like Web?A More Flash Like Web?
A More Flash Like Web?
 
The jsdom
The jsdomThe jsdom
The jsdom
 
Augmented Reality in JavaScript
Augmented Reality in JavaScriptAugmented Reality in JavaScript
Augmented Reality in JavaScript
 
HTML5 video filters
HTML5 video filtersHTML5 video filters
HTML5 video filters
 
Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012Leaving Flatland: Getting Started with WebGL- SXSW 2012
Leaving Flatland: Getting Started with WebGL- SXSW 2012
 
A Novice's Guide to WebGL
A Novice's Guide to WebGLA Novice's Guide to WebGL
A Novice's Guide to WebGL
 
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
 
Full Stack 2019 edition
Full Stack 2019 editionFull Stack 2019 edition
Full Stack 2019 edition
 
Jeroen Vloothuis Bend Kss To Your Will
Jeroen Vloothuis   Bend Kss To Your WillJeroen Vloothuis   Bend Kss To Your Will
Jeroen Vloothuis Bend Kss To Your Will
 
Будь первым
Будь первымБудь первым
Будь первым
 
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
 

Semelhante a Creating Applications with WebGL and Three.js

WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash CourseTony Parisi
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123Parag Gajbhiye
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishSven Haiges
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合Kyle Lin
 
WebGL: The Next Generation
WebGL:  The Next GenerationWebGL:  The Next Generation
WebGL: The Next GenerationTony Parisi
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsJames Williams
 
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docxcase3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docxtidwellveronique
 
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014Zero-config JavaScript apps with RaveJS -- SVCC fall 2014
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014John Hann
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 
The Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesThe Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesTse-Ching Ho
 
Groovy Grails Gr8Ladies Women Techmakers: Minneapolis
Groovy Grails Gr8Ladies Women Techmakers: MinneapolisGroovy Grails Gr8Ladies Women Techmakers: Minneapolis
Groovy Grails Gr8Ladies Women Techmakers: MinneapolisJenn Strater
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO TimeTony Parisi
 
Art & music vs Google App Engine
Art & music vs Google App EngineArt & music vs Google App Engine
Art & music vs Google App Enginethomas alisi
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Matt Raible
 
Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Jorge Franco Leza
 

Semelhante a Creating Applications with WebGL and Three.js (20)

WebGL Crash Course
WebGL Crash CourseWebGL Crash Course
WebGL Crash Course
 
cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123cdac@parag.gajbhiye@test123
cdac@parag.gajbhiye@test123
 
Fewd week6 slides
Fewd week6 slidesFewd week6 slides
Fewd week6 slides
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
 
淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合淺談 Groovy 與 AWS 雲端應用開發整合
淺談 Groovy 與 AWS 雲端應用開發整合
 
WebGL: The Next Generation
WebGL:  The Next GenerationWebGL:  The Next Generation
WebGL: The Next Generation
 
Ratpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web AppsRatpack - Classy and Compact Groovy Web Apps
Ratpack - Classy and Compact Groovy Web Apps
 
Grails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLTGrails 1.4.0.M1 メモLT
Grails 1.4.0.M1 メモLT
 
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docxcase3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
case3h231diamond.gifcase3h231energy.jpgcase3h231moder.docx
 
Os Secoske
Os SecoskeOs Secoske
Os Secoske
 
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014Zero-config JavaScript apps with RaveJS -- SVCC fall 2014
Zero-config JavaScript apps with RaveJS -- SVCC fall 2014
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
The Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & TemplatesThe Power of Rails 2.3 Engines & Templates
The Power of Rails 2.3 Engines & Templates
 
Groovy Grails Gr8Ladies Women Techmakers: Minneapolis
Groovy Grails Gr8Ladies Women Techmakers: MinneapolisGroovy Grails Gr8Ladies Women Techmakers: Minneapolis
Groovy Grails Gr8Ladies Women Techmakers: Minneapolis
 
WebGL - It's GO Time
WebGL - It's GO TimeWebGL - It's GO Time
WebGL - It's GO Time
 
Art & music vs Google App Engine
Art & music vs Google App EngineArt & music vs Google App Engine
Art & music vs Google App Engine
 
Test Driven In Groovy
Test Driven In GroovyTest Driven In Groovy
Test Driven In Groovy
 
Sequelize
SequelizeSequelize
Sequelize
 
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
Comparing Hot JavaScript Frameworks: AngularJS, Ember.js and React.js - Sprin...
 
Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015Grooscript in Action SpringOne2gx 2015
Grooscript in Action SpringOne2gx 2015
 

Mais de Future Insights

The Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaThe Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaFuture Insights
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromFuture Insights
 
Putting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraPutting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraFuture Insights
 
Surviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMSurviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMFuture Insights
 
Exploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongExploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongFuture Insights
 
A Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyA Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyFuture Insights
 
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnHorizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnFuture Insights
 
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Future Insights
 
Front End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFront End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFuture Insights
 
Structuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzStructuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzFuture Insights
 
Cinematic UX, Brad Weaver
Cinematic UX, Brad WeaverCinematic UX, Brad Weaver
Cinematic UX, Brad WeaverFuture Insights
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookFuture Insights
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisFuture Insights
 
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionAccessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionFuture Insights
 
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Future Insights
 
Designing for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanDesigning for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanFuture Insights
 
Beyond Measure, Erika Hall
Beyond Measure, Erika HallBeyond Measure, Erika Hall
Beyond Measure, Erika HallFuture Insights
 
Real Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonReal Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonFuture Insights
 
Ok Computer. Peter Gasston
Ok Computer. Peter GasstonOk Computer. Peter Gasston
Ok Computer. Peter GasstonFuture Insights
 
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaDigital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaFuture Insights
 

Mais de Future Insights (20)

The Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'SheaThe Human Body in the IoT. Tim Cannon + Ryan O'Shea
The Human Body in the IoT. Tim Cannon + Ryan O'Shea
 
Pretty pictures - Brandon Satrom
Pretty pictures - Brandon SatromPretty pictures - Brandon Satrom
Pretty pictures - Brandon Satrom
 
Putting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-GuerraPutting real time into practice - Saul Diez-Guerra
Putting real time into practice - Saul Diez-Guerra
 
Surviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDMSurviving the enterprise storm - @RianVDM
Surviving the enterprise storm - @RianVDM
 
Exploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny TongExploring Open Date with BigQuery: Jenny Tong
Exploring Open Date with BigQuery: Jenny Tong
 
A Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher MurphyA Universal Theory of Everything, Christopher Murphy
A Universal Theory of Everything, Christopher Murphy
 
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff JahnHorizon Interactive Awards, Mike Sauce & Jeff Jahn
Horizon Interactive Awards, Mike Sauce & Jeff Jahn
 
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
Reading Your Users’ Minds: Empiricism, Design, and Human Behavior, Shane F. B...
 
Front End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon DeanerFront End Development Transformation at Scale, Damon Deaner
Front End Development Transformation at Scale, Damon Deaner
 
Structuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean LorenzStructuring Data from Unstructured Things. Sean Lorenz
Structuring Data from Unstructured Things. Sean Lorenz
 
Cinematic UX, Brad Weaver
Cinematic UX, Brad WeaverCinematic UX, Brad Weaver
Cinematic UX, Brad Weaver
 
The Future is Modular, Jonathan Snook
The Future is Modular, Jonathan SnookThe Future is Modular, Jonathan Snook
The Future is Modular, Jonathan Snook
 
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie RewisDesigning an Enterprise CSS Framework is Hard, Stephanie Rewis
Designing an Enterprise CSS Framework is Hard, Stephanie Rewis
 
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison AsuncionAccessibility Is More Than What Lies In The Code, Jennison Asuncion
Accessibility Is More Than What Lies In The Code, Jennison Asuncion
 
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
Sunny with a Chance of Innovation: A How-To for Product Managers and Designer...
 
Designing for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew ZusmanDesigning for Dyslexia, Andrew Zusman
Designing for Dyslexia, Andrew Zusman
 
Beyond Measure, Erika Hall
Beyond Measure, Erika HallBeyond Measure, Erika Hall
Beyond Measure, Erika Hall
 
Real Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur ThorleifssonReal Artists Ship, Haraldur Thorleifsson
Real Artists Ship, Haraldur Thorleifsson
 
Ok Computer. Peter Gasston
Ok Computer. Peter GasstonOk Computer. Peter Gasston
Ok Computer. Peter Gasston
 
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi KayaDigital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
Digital Manuscripts Toolkit, using IIIF and JavaScript. Monica Messaggi Kaya
 

Último

定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationLinaWolf1
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predieusebiomeyer
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxBipin Adhikari
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxeditsforyah
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleanscorenetworkseo
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 

Último (20)

定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
PHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 DocumentationPHP-based rendering of TYPO3 Documentation
PHP-based rendering of TYPO3 Documentation
 
SCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is prediSCM Symposium PPT Format Customer loyalty is predi
SCM Symposium PPT Format Customer loyalty is predi
 
Intellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptxIntellectual property rightsand its types.pptx
Intellectual property rightsand its types.pptx
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in  Rk Puram 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Rk Puram 🔝 9953056974 🔝 Delhi escort Service
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Q4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptxQ4-1-Illustrating-Hypothesis-Testing.pptx
Q4-1-Illustrating-Hypothesis-Testing.pptx
 
Elevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New OrleansElevate Your Business with Our IT Expertise in New Orleans
Elevate Your Business with Our IT Expertise in New Orleans
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 

Creating Applications with WebGL and Three.js

  • 1. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 1/38 Creating Applications with WebGL and Three.js +James Williams @ecspike
  • 2. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 2/38 About Me Author of Learning HTML5 Game Programming Writing a new book on Three.js
  • 3. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 3/38 Learning HTML5 Game Programming
  • 4. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 4/38 Agenda What is WebGL/Three.js? Creating Meshes Lighting and Shading Working with Physics Engines Demos
  • 5. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 5/38 What is WebGL? Low-level 3D graphics context Uses canvas tag Hardware-accelerated Syntax based on OpenGL ES 2.0
  • 6. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 6/38 Why aren't we using raw WebGL? Higher barrier to entry Lots of code Requires directly managing data structures
  • 7. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 7/38 What is Three.js? 3D scenegraph library Abstracts the nastiness away from WebGL Renders to Canvas 2D, WebGL, SVG Can animate HTML elements using CSS3 Can import models from popular 3D modeling apps
  • 8. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 8/38 Creating a basic app Scene Camera Renderer Lighting (optional)
  • 9. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 9/38 Camera Eye Point Field of Vision Near/Far Planes Target (LookAt) Point Up Vector camera = new THREE.PerspectiveCamera(FOV, ASPECT, NEAR, FAR, [target]);
  • 10. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 10/38 A Basic Scene @renderer = new THREE.WebGLRenderer({autoClear:true}) @renderer.setClearColor(new THREE.Color(0x000000)) @renderer.setSize(width, height) @camera = new THREE.PerspectiveCamera(fov, aspect, near, far) @camera.position.z = 100 @scene = new THREE.Scene() $('#container').empty() $("#container").get(0).appendChild(@renderer.domElement) @scene.add(@camera) # truncated @renderer.render(@scene, @camera)
  • 11. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 11/38 Creating Meshes new THREE.Mesh(new CubeGeometry(100,1,100), new THREE.MeshBasicMaterial({color: 0xFF0000})) Built-in Geometries SphereGeometry PlaneGeometry CylinderGeometry CubeGeometry TextGeometry and several others
  • 12. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 12/38 Materials # Basic Material new THREE.MeshBasicMaterial({color: 0xFFFFFF}) # Per-vertex coloring f = triGeometry.faces[0] f.vertexColors[0] = vColors[0] f.vertexColors[1] = vColors[1] f.vertexColors[2] = vColors[2] triMaterial = new THREE.MeshBasicMaterial( {color: 0xFFFFFF, vertexColors:THREE.VertexColors} ) # Phong, Lambert, Face, Line, etc
  • 13. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 13/38 Demo
  • 14. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 14/38 Loading Models Blender Collada OBJ MAX Maya
  • 15. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 15/38 Loading A Model @models = {} loader = new THREE.JSONLoader() loader.load('/models/hero.js', @heroCallback) heroCallback: (g, m) -> obj = new THREE.Mesh(g, new THREE.MeshFaceMaterial(m)) obj.rotation.x = -1.57 obj.position.y = 100 obj.scale.set(6,6,6) app.hero = obj app.scene.add(app.hero)
  • 16. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 16/38 Loading A Scene loader = new THREE.SceneLoader() loader.callbackProgress = @callbackProgress loader.load( "scripts/scenes/falling-ball.js", self.callbackFinished) # Receives updates from loader callbackProgress: (progress, result) -> console.log result console.log progress # Called when finished loading callbackFinished: (result) -> app.scene = result.scene app.camera = result.cameras.Camera app.camera.lookAt(new THREE.Vector3(0,0,0))
  • 17. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 17/38 Three.js Editor Create primitive objects Add materials Export objects or scenes http://threejs.org/editor
  • 18. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 18/38 Demo
  • 19. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 19/38 What is GLSL? Targets the GPU and graphics pipeline High level language with C-like syntax Passed around as strings Can be generated and compiled at run-time Referred to as programs (the combination of a vertex and fragment shader)
  • 20. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 20/38 Vertex Shaders Run once per vertex in a mesh Can alter color, position, or texture coordinates
  • 21. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 21/38 Example vertex shader <script id="shader-vs" type="x-shader/x-vertex"> #ifdef GL_ES precision highp float; #endif void main(void) { gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0); } </script>
  • 22. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 22/38 Frament(Pixel) Shaders Run on every pixel in a mesh Can produce effects such as bump mapping and shadowing Only knows* about the pixel it is working on
  • 23. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 23/38 Example fragment shader <script id="shader-vs" type="x-shader/x-vertex"> #ifdef GL_ES precision highp float; #endif void main(void) { gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0); } </script>
  • 24. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 24/38 Cel (Toon) Shading uniform vec3 diffuse; //from http://www.neocomputer.org/projects/donut gl_FragColor = vec4(diffuse, 1.0); vec3 basecolor=vec3(gl_FragColor[0], gl_FragColor[1], gl_FragColor[2]); float alpha = gl_FragColor[3]; float vlf = vLightFront[0]; // Clean and simple // if (vlf< 0.50) { gl_FragColor = vec4(mix( basecolor, vec3(0.0), 0.5), alpha); } if (vlf>=0.50) { gl_FragColor = vec4(mix( basecolor, vec3(0.0), 0.3), alpha); } if (vlf>=0.75) { gl_FragColor = vec4(mix( basecolor, vec3(1.0), 0.0), alpha); } //if (vlf>=0.95) { // gl_FragColor = vec4(mix( basecolor, vec3(1.0), 0.3), alpha); } // gl_FragColor.xyz *= vLightFront;
  • 25. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 25/38 Shader Toy Website enabling you to play around with GLSL shaders http://www.iquilezles.org/apps/shadertoy/
  • 26. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 26/38 Demo
  • 27. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 27/38 Collision Detection Bounding Box Bounding Sphere Rays
  • 28. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 28/38 Physics using Physijs Integrates deeply with Three.js Built upon ammo.js https://github.com/chandlerprall/Physijs
  • 29. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 29/38 Sample Physijs Scene # setup Physi Physijs.scripts.worker = 'scripts/vendor/physijs/physijs_worker.js' Physijs.scripts.ammo = 'ammo.js' @scene = new Physijs.Scene() @scene.setGravity new THREE.Vector3( 0, -30, 0 ) obj = new Physijs.Mesh(rawMesh.geometry, material, mass) render: () -> @scene.simulate() @renderer.render(@scene, @camera)
  • 30. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 30/38 Demo
  • 31. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 31/38 Creating A Simple Game
  • 32. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 32/38 My First Computer
  • 33. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 33/38 My First Computer Game
  • 34. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 34/38 Demos
  • 35. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 35/38 WebGL Inspector Allows you to incrementally step through rendering View texture assets and GLSL programs Permits capturing individual frames Can be embedded or installed as a Chrome/Webkit extension Github: http://benvanik.github.com/WebGL-Inspector/
  • 36. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 36/38 Questions ?
  • 37. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 37/38 Links and Sources Adam II photo: http://www.digibarn.com/collections/systems/coleco- adam/CIMG3282.JPG Buck Rogers photo: http://telebunny.net/toastyblog/wp- content/uploads/2012/08/gsj12-buckrogers2.gif
  • 38. 6/17/2014 Getting started with WebGL and Three.js file:///Users/james/Downloads/3js-2013/index.html#1 38/38