SlideShare a Scribd company logo
Developing Interactive
3D Experiences in HTML5
Carlos Ulloa
HelloEnjoy.com
FITC Amsterdam 2014
@C4RL05
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
GFX

AUDIO

INPUT
Developing
Interactive 3D
Experiences in
HTML5
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
1-CLICK
WORK
FLOW
Workflow first
& then performance
Test early
First build in 2 weeks
Test often
One or two builds per week
Prototype
From concept & design
GFX
GAME LOOP
Optimise
your game loop
Object Pooling
Minimise garbage collection
Spread
& interpolate over frames
TIME
Frame Rate
Independent
requestAnimationFrame
deltaTime
Since the last frame
Multiply by

deltaTime
to update values

per second
instead of per frame
Cap deltaTime
< 0.1 second
timeScale
Multiplies deltaTime
Keep Sync
with music & video
THREE.JS
Examples
threejs.org/examples
Source Code
three.js/src
Docs
threejs.org/docs
ASSET PIPELINE
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
MATH
VEC

QUAT

MTRX
VECTORS
Vectors
Represent position, direction,
velocity, acceleration, forces…
( x, y, z )
Not very intuitive on multiple axes
object.position
Local position
object.scale
Local scale
|a|
Magnitude
|a| = 1
Normalized
+
DOT PRODUCT
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Dot Product
|a| |b| cos
Dot Product
+
CROSS PRODUCT
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Cross Product
|a| |b| sin
Cross Product
QUATERNIONS
Quaternions
Represent rotations
object.quaternion
Local rotation
Multiply quaternions
to rotate a vector or another rotation
Slerp quaternions
to interpolate rotations
Avoid Euler
on multiple axes
MATRICES
Matrices
Represent transformations
i.e. position, rotation, scale
object.matrix
Local transform
object.matrixWorld
Global transform
Multiply matrices
to transform a vector or another matrix
Transform methods
lookAt, translateXYZ, rotateXYZ,
localToWorld, worldToLocal
OBJECTS
HIERARCHY
GROUPS
PIVOTS
Children methods
getDescendants, traverse
Helper Objects
Arrow, Axis, Bounding Box,
Camera, Grid, Lights
MESHES
Geometry
Build your own
Vertex Color
Paint, bake or create in code
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
TEXTURES
Mip Maps
Smaller versions of the texture
Offset & Repeat
Transform textures
Anisotropy
Fix mip map artifacts
Wrap
Repeat, Clamp, Mirror
Clamp Wrap
Fix artifacts on texture seams
RGBA
Use all channels
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
LIGHTS
Dynamic Lights
Real-time surface illumination
Baked Lights
Better quality & performance
Lightmaps
Global illumination
Vertex Bake
Quality depends on geometry
CAMERA
Avoid
default camera settings
Near Plane
Occlusion & fill rate performance
Far Plane
Horizon pop up & removed geometry
FRUSTUM
CULLING
Near

Far
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Bounding
Sphere
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
FOV
Vertical angle
FOV
FOV
Different for each scene
POST PROCESSING
FXAA
8X
8X
SSAO
Cry Engine
GLOW
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
VIGNETTE
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
OPTIMISE
Profile & measure
Understand what’s going on
GPU

CPU
GPU
GPU?
Faster in lower res
GPU
Many pixels, fill rate bound
CPU
CPU?
Faster with objects disabled
CPU
Many objects, many draw calls
DRAW CALLS
Minimise
state changes & draw calls
Batching
Combine meshes with same material
Batch Static
Always combine static objects
Combine Materials
Use vertex & textures to differentiate
Texture Atlas
Combine textures
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Multiple Passes
Multiple draw calls
SHADERS
Objects < Vertices < Pixels
Vertex
Instead of fragment
Precission
Colors & normals
Alpha Test
Instead of Alpha Blend
Fragment Math
Avoid pow, sin, cos
Vector Math
Dot & Cross Product
LOD
Level of detail
Simpler far away objects
Optimised
geometries or materials
Sprites
& particle systems
Skybox & Rings
for very distant objects
MOBILE
Mobile < Desktop
Low Polycount
> 500
Overdraw
Depends on the GPU
Fill Rate
devicePixelRatio
Upscale
For higher resolutions
Downscale
For higher quality renders
Simple Shaders
Minimise fragment complexity
No Bumps
Avoid normal mapping
No Lights
Avoid dynamic lighting or shadows
No Fog
Only on vertex shader
No Post
Avoid full screen effects
lowp
getShaderPrecisionFormat
AUDIO
WEB AUDIO
Audio
Processing & analysis
Audio Node
Web Audio API building block
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
Panner Node
for positional audio
Logarithmic
scale for spectrum analysis
Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa
INPUT
KEYBOARD
Analog
Simulate key pressure
Each key
on its own
Combine
keys to create axes
MOUSE
Pointer Lock
Relative mouse movement
Relative Mouse
Accumulated deltas
DPI
& different screen sizes
Sensitivity
Users ignore settings
TOUCH
Relative
touch controls
Orientation
How users hold the device?
Secondary
touch support
LEAP MOTION
Smooth
Introduces lag
Calibration
Don’t leave it to the user
Relative
Real time calibration
Slides
helloenjoy.com/docs/3DJSDev.pdf
DANK U
helloenjoy.com

More Related Content

PPT
Bending the Graphics Pipeline
PPTX
Adding more visuals without affecting performance
PPTX
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
PDF
Adobe AIR for mobile games
PPT
Destruction Masking in Frostbite 2 using Volume Distance Fields
ODP
A stack of shaders applied to create the 'old TV' effect
KEY
Practical Occlusion Culling in Killzone 3
PPTX
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems
Bending the Graphics Pipeline
Adding more visuals without affecting performance
A Certain Slant of Light - Past, Present and Future Challenges of Global Illu...
Adobe AIR for mobile games
Destruction Masking in Frostbite 2 using Volume Distance Fields
A stack of shaders applied to create the 'old TV' effect
Practical Occlusion Culling in Killzone 3
HPG 2018 - Game Ray Tracing: State-of-the-Art and Open Problems

What's hot (9)

PPT
5 Major Challenges in Interactive Rendering
PDF
Maxon Cinema4D R17 cheat sheet (Windows)
PDF
Maxon Cinema4D R17 cheat sheet (Mac)
PPTX
Khronos Munich 2018 - Halcyon and Vulkan
PDF
Starling Deep Dive
PDF
Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013
PDF
Syysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray Tracing
PDF
Compute Cloud for Rendering
PPT
SIGGRAPH 2010 - Style and Gameplay in the Mirror's Edge
5 Major Challenges in Interactive Rendering
Maxon Cinema4D R17 cheat sheet (Windows)
Maxon Cinema4D R17 cheat sheet (Mac)
Khronos Munich 2018 - Halcyon and Vulkan
Starling Deep Dive
Google Chrome DevTools: Rendering & Memory profiling on Open Academy 2013
Syysgraph 2018 - Modern Graphics Abstractions & Real-Time Ray Tracing
Compute Cloud for Rendering
SIGGRAPH 2010 - Style and Gameplay in the Mirror's Edge
Ad

Viewers also liked (20)

PDF
Responsive Design Techniques, Tools and Design Strategies with Paul Trani
PPT
OneMethod in a Nutshell
PDF
Rik
PPTX
Shepherding Innovation
PDF
Mistakes, Lessons, and Being Creative
PPTX
Hacking the Creative Brain
PDF
It’s Not Enough To Be Brilliant – You Have To Be Convincing, Too. with Lanny...
PDF
Git hub for designers
PDF
HelloRun: A Hypnotic 3D Runner Music Game
PDF
Make Something Ugly: An Experimental Creative Process with Myron Campbell
PDF
Experimenting with Creative Process with Qanta Shimizu
PDF
Meet MILL+ with Carl Addy
PDF
Fitc presentation
PPTX
Backyard Brains: Bringing the Body’s Electrical Signals Out of the Body
PDF
Charity apprentice logo-blue-6675
PDF
The Sum Is Greater Than The Parts
PPT
Unity: From Indie Game Start-Up to International Real-Time 3D Tool of Choice
PDF
Process
Responsive Design Techniques, Tools and Design Strategies with Paul Trani
OneMethod in a Nutshell
Rik
Shepherding Innovation
Mistakes, Lessons, and Being Creative
Hacking the Creative Brain
It’s Not Enough To Be Brilliant – You Have To Be Convincing, Too. with Lanny...
Git hub for designers
HelloRun: A Hypnotic 3D Runner Music Game
Make Something Ugly: An Experimental Creative Process with Myron Campbell
Experimenting with Creative Process with Qanta Shimizu
Meet MILL+ with Carl Addy
Fitc presentation
Backyard Brains: Bringing the Body’s Electrical Signals Out of the Body
Charity apprentice logo-blue-6675
The Sum Is Greater Than The Parts
Unity: From Indie Game Start-Up to International Real-Time 3D Tool of Choice
Process
Ad

Similar to Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa (20)

PDF
Korea linuxforum2014 html5game-sangseoklim
PPT
WebGL: GPU acceleration for the open web
PPTX
HTML5 and Other Modern Browser Game Tech
PDF
mloc.js 2014 - JavaScript and the browser as a platform for game development
PPTX
Penn graphics
PDF
One codebase, multiple platforms; Using HTML5/js for game dev
PDF
Understanding Hardware Acceleration on Mobile Browsers
ODP
HTML5 Game Development frameworks overview
DOCX
Constraints
PPTX
Mastering Multiplayer Stage3d and AIR game development for mobile devices
PDF
From Experimentation to Production: The Future of WebGL
PPTX
Building Rich Internet Applications with HTML5 and WebGL
PDF
W3C HTML5 KIG-The complete guide to building html5 games
PPTX
Flash Gamm 2011,"Stage3D survival guide"
PPTX
FGS 2011: Flash+ A Whole New Dimension for Games
PPTX
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
PPT
OWC 2012 (Open Web Camp)
PPTX
Advanced Mobile Optimizations
PDF
Building VR Applications For Google Cardboard
PDF
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...
Korea linuxforum2014 html5game-sangseoklim
WebGL: GPU acceleration for the open web
HTML5 and Other Modern Browser Game Tech
mloc.js 2014 - JavaScript and the browser as a platform for game development
Penn graphics
One codebase, multiple platforms; Using HTML5/js for game dev
Understanding Hardware Acceleration on Mobile Browsers
HTML5 Game Development frameworks overview
Constraints
Mastering Multiplayer Stage3d and AIR game development for mobile devices
From Experimentation to Production: The Future of WebGL
Building Rich Internet Applications with HTML5 and WebGL
W3C HTML5 KIG-The complete guide to building html5 games
Flash Gamm 2011,"Stage3D survival guide"
FGS 2011: Flash+ A Whole New Dimension for Games
Using The New Flash Stage3D Web Technology To Build Your Own Next 3D Browser ...
OWC 2012 (Open Web Camp)
Advanced Mobile Optimizations
Building VR Applications For Google Cardboard
Neurotech Solutions Ltd: Рекомендации по Stage3D: выбор наиболее подходящего ...

More from FITC (20)

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

Recently uploaded (20)

PDF
Interior Structure and Construction A1 NGYANQI
PPTX
YV PROFILE PROJECTS PROFILE PRES. DESIGN
PPTX
Fundamental Principles of Visual Graphic Design.pptx
PDF
Urban Design Final Project-Context
PPTX
6- Architecture design complete (1).pptx
DOCX
The story of the first moon landing.docx
PPTX
building Planning Overview for step wise design.pptx
PPTX
Special finishes, classification and types, explanation
PDF
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
PDF
Phone away, tabs closed: No multitasking
PPTX
rapid fire quiz in your house is your india.pptx
PPTX
Wisp Textiles: Where Comfort Meets Everyday Style
PDF
YOW2022-BNE-MinimalViableArchitecture.pdf
PDF
Skskkxiixijsjsnwkwkaksixindndndjdjdjsjjssk
PDF
Urban Design Final Project-Site Analysis
PDF
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
PPTX
12. Community Pharmacy and How to organize it
PPTX
Media And Information Literacy for Grade 12
PDF
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
PPTX
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
Interior Structure and Construction A1 NGYANQI
YV PROFILE PROJECTS PROFILE PRES. DESIGN
Fundamental Principles of Visual Graphic Design.pptx
Urban Design Final Project-Context
6- Architecture design complete (1).pptx
The story of the first moon landing.docx
building Planning Overview for step wise design.pptx
Special finishes, classification and types, explanation
Design Thinking - Module 1 - Introduction To Design Thinking - Dr. Rohan Dasg...
Phone away, tabs closed: No multitasking
rapid fire quiz in your house is your india.pptx
Wisp Textiles: Where Comfort Meets Everyday Style
YOW2022-BNE-MinimalViableArchitecture.pdf
Skskkxiixijsjsnwkwkaksixindndndjdjdjsjjssk
Urban Design Final Project-Site Analysis
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
12. Community Pharmacy and How to organize it
Media And Information Literacy for Grade 12
Emailing DDDX-MBCaEiB.pdf DDD_Europe_2022_Intro_to_Context_Mapping_pdf-165590...
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx

Developing Interactive 3D Experiences in HTML5 with Carlos Ulloa