SlideShare a Scribd company logo
1 of 53
Three JS, Unreal, Unity.
VR/AR without 9 circles of hell
by Marina Kolesnichenko, Software Engineer at ElifTech
Three.js cookbook
Three.js is a cross-browser
JavaScript library/API used to create
and display animated 3D computer
graphics in a web browser.
Three.js uses WebGL.
Quick start
http://threejs.org/
Click the “Download” link on the left side of your screen. Once the zip has
finished downloading, open it up and go to the build folder. Inside, you’ll
find a file called three.min.js and, if you’re following along, you should copy
this file into your local development directory.
What about NPM?
npm install three
But this library version is 'limited' at moment.
So I recommend download library from official
site.
Browsers
Easy 0-20 level
Scene
new THREE.Scene();
new THREE.PerspectiveCamera(45,
width / height, 1, 10000);
Position Range
More power!
OBJLoader
A loader for loading an .obj resource.
Basic
var loader = new THREE.OBJLoader();
// load a resource
loader.load(
// resource URL
'models/monster.obj',
// function when resource is loaded
function ( object ) {
scene.add( object );
}
);
With .mtl
loadModel(model, options, done) {
let name = model.split("/").pop();
let path = `${model.substring(0,
model.lastIndexOf("/"))}/`;
this.mtl.setPath(path);
this.mtl.load(`${name}.mtl`, (materials) => {
materials.preload();
for (let key in materials.materials) {
let material = materials.materials[key];
material.shading = THREE.SmoothShading;
material.side = THREE.DoubleSide;
}
this.obj.setMaterials(materials);
this.obj.setPath(path);
this.obj.load(`${name}.obj`, (object) => {
object.name = options.name || "Scene";
object.position.fromArray(options.position ||
[0, 0, 0]);
object.rotation.fromArray(options.rotation ||
[0, 0, 0]);
object.scale.set(options.scale || 1,
options.scale || 1, options.scale || 1);
object.traverse((child) => {
if (child instanceof THREE.Mesh) {
child.current = {};
child.original = {};
child.original.material =
child.material.clone();
child.receiveShadow = false;
child.castShadow = true;
}
});
done(object, materials.materials);
});
});
}
What?
Material Library File (.mtl)
Material library files contain one or more material definitions, each of which
includes the color, texture, and reflection map of individual materials. These
are applied to the surfaces and vertices of objects. Material files are stored
in ASCII format and have the .mtl extension.
Render scene
render() {
if (this.mode == 'vr') {
this.stereo.render(this.scene, this.camera);
} else {
this.renderer.render(this.scene, this.camera);
}
window.requestAnimationFrame(() => {
this.controls.update();
this.update(delta);
this.render();
});
}
20-65 level
Workflow
new THREE.BoxGeometry
new THREE.MeshBasicMaterial
( { color: 0xff0000, wireframe: true } )
Workflow
Workflow
Audio
this.camera.listener = new THREE.AudioListener();
this.camera.listener.name = 'Audio Listener';
this.camera.add(this.camera.listener);
Hard 65-80 level
Shaders
A Shader is a piece of code that runs directly on the
GPU. Most modern devices have powerful GPUs
designed to handle graphics effects without taxing the
CPU.
Pixels Vertex
Shaders
or Babylon...
Pixels
Pixel Shaders modify or draw the pixels in a scene. They
are used to render a 3D scene into pixels, and also
typically used to add lighting and other effects to a 3D
scene.
Pixels
Shaders that draw an image or texture directly. These
types of shaders can be loaded into a
THREE.ShaderMaterial to give cool textures to 3D
objects.
Pixels
Shaders that modify another image or texture. These
allow you to do post-processing on an existing texture,
for example to add a glow or blur to a 3D scene.
Vertex
Vertex shaders generate or modify 3D geometry by
manipulating its vertices.
Vertex
Vertex
Physics
VR
VR
this.stereo = new THREE.OculusRiftEffect(this.renderer);
let hmd = this.stereo.getHMD();
hmd.hResolution = this.width;
hmd.vResolution = this.height;
this.stereo.setHMD(hmd);
this.stereo.setSize(this.width, this.height);
this.stereo.render(this.scene, this.camera);
VR
VR
Raycaster
this.raycaster = new THREE.Raycaster();
this.raycaster.setFromCamera(new THREE.Vector2(),
this.camera);
let intersects = this.raycaster.intersectObject(object,
true);
OSGJS
OSGJS is based on OpenSceneGraph API, which itself is
based on a few concepts that allow for a solid grasp
around the whole library once and for all, and those are
mandatory in order to dive into code.
Difference
viewer = new osgViewer.Viewer(canvas, {antialias : true,
alpha: true });
rotate = new osg.MatrixTransform();
viewer.setupManipulator(new osgGA.OrbitManipulator());
viewer.getManipulator().setDistance(20.0);
viewer.run();
Why not?
1. FPS and freezes
2. Limited scene
3. Difficult work with animation and shaders
Unity/Unreal
Easy
Mobile
Fast
graphicsBest
Unreal Engine uses C++ and Unity uses mostly C# or JavaScript. Unreal
Engine has Blueprint visual scripting. Technically you don't ever need to
write a single line of code.
All pointers of objects that are at the level should point to objects at the
level and objects outside the level can't have pointers pointing to objects at
the level.
VR
Virtual reality (VR), which can be referred to as immersive multimedia or
computer-simulated reality, replicates an environment that simulates a
physical presence in places in the real world or an imagined world, allowing
the user to interact in that world.
VR
VR
VR
Device?
AR
Augmented reality (AR) is a live, direct or indirect view of a physical, real-
world environment whose elements are augmented (or supplemented) by
computer-generated sensory input such as sound, video, graphics or GPS
data
VR, ok! AR, ok!
MR O_O?
Mixed reality - is the merging of real and virtual worlds to produce
new environments and visualisations where physical and digital
objects co-exist and interact in real time. Mixed reality is an
overlay of synthetic content on the real world that is anchored to
and interacts with the real world—picture surgeons overlaying
virtual ultrasound images on their patient while performing an
operation, for example. The key characteristic of MR is that the
synthetic content and the real-world content are able to react to
each other in real time.
WOW!
Overdraw
Overdraw view allows you to see what objects are drawn
on top of another, which is a waste of GPU time. Look at
reducing overdraw as much as possible. You can view
overdraw in the Scene View by using the Scene View
Control Bar.
Overdraw
Occlusion
Occlusion Culling stops objects from being rendered if
they cannot be seen. For example, we don’t want to
render another room if a door is closed and it cannot be
seen.
Occlusion
Rendering
Approximating your own distortion solution, even when it “looks about
right,” is often discomforting for users.
Any deviation from the optical flow that accompanies real world head
movement creates oculomotor issues and bodily discomfort.
Consider supersampling and/or anti-aliasing to remedy low apparent
resolution, which will appear worst at the center of each eye’s screen.
Tabu
Minimizing Latency
Your code should run at a frame rate equal to or greater than the Rift
display refresh rate, v-synced and unbuffered. Lag and dropped frames
produce judder which is discomforting in VR.
Ideally, target 20ms or less motion-to-photon latency (measurable with the
Rift’s built-in latency tester). Organize your code to minimize the time from
sensor fusion (reading the Rift sensors) to rendering.
Decrease eye-render buffer resolution to save video memory and increase
frame rate.
Avoid visuals that upset the user’s sense of stability in their
environment. Rotating or moving the horizon line or other large
components of the user’s environment in conflict with the user’s real-
world self-motion (or lack thereof) can be discomforting.
Feel free to ask questions
in the comments
Thank you for attention!
Find us at eliftech.com
Have a question? Contact us:
info@eliftech.com

More Related Content

Viewers also liked

Luis cataldi-siggraph 2015
Luis cataldi-siggraph 2015Luis cataldi-siggraph 2015
Luis cataldi-siggraph 2015Luis Cataldi
 
Getting Started with C/C# Game Development Part 1
Getting Started with C/C# Game Development Part 1Getting Started with C/C# Game Development Part 1
Getting Started with C/C# Game Development Part 1CEGD
 
Introduction to wave engine
Introduction to wave engineIntroduction to wave engine
Introduction to wave enginewaveengineteam
 
Ue4 siggraph-nick-whiting
Ue4 siggraph-nick-whitingUe4 siggraph-nick-whiting
Ue4 siggraph-nick-whitingLuis Cataldi
 
Luis Catald IGDA Sept 2015
Luis Catald IGDA Sept 2015Luis Catald IGDA Sept 2015
Luis Catald IGDA Sept 2015Luis Cataldi
 
沖縄まで踊りに来たぜ!VR/AR/MR最前線
沖縄まで踊りに来たぜ!VR/AR/MR最前線沖縄まで踊りに来たぜ!VR/AR/MR最前線
沖縄まで踊りに来たぜ!VR/AR/MR最前線Satoshi Maemoto
 
Luis cataldi unreal engine for educators
Luis cataldi   unreal engine for educatorsLuis cataldi   unreal engine for educators
Luis cataldi unreal engine for educatorsLuis Cataldi
 
VR/AR/MRってなんですか?
VR/AR/MRってなんですか?VR/AR/MRってなんですか?
VR/AR/MRってなんですか?Satoshi Maemoto
 
Disruptive Innovation
Disruptive InnovationDisruptive Innovation
Disruptive InnovationKen Koo
 
Apache Yetus: Intro to Precommit for HBase Contributors
Apache Yetus: Intro to Precommit for HBase ContributorsApache Yetus: Intro to Precommit for HBase Contributors
Apache Yetus: Intro to Precommit for HBase ContributorsAllen Wittenauer
 
Apache Yetus: Helping Solve the Last Mile Problem
Apache Yetus: Helping Solve the Last Mile ProblemApache Yetus: Helping Solve the Last Mile Problem
Apache Yetus: Helping Solve the Last Mile ProblemAllen Wittenauer
 
Kim libreri-siggraph 2015
Kim libreri-siggraph 2015Kim libreri-siggraph 2015
Kim libreri-siggraph 2015Luis Cataldi
 
Hadoop Operations at LinkedIn
Hadoop Operations at LinkedInHadoop Operations at LinkedIn
Hadoop Operations at LinkedInAllen Wittenauer
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game DevelopmentMohammad Shaker
 
EA: Optimization of mobile Unity application
EA: Optimization of mobile Unity applicationEA: Optimization of mobile Unity application
EA: Optimization of mobile Unity applicationDevGAMM Conference
 
15 vr trends 2017 yariv levski
15 vr trends 2017 yariv levski15 vr trends 2017 yariv levski
15 vr trends 2017 yariv levskiAppReal-VR
 

Viewers also liked (16)

Luis cataldi-siggraph 2015
Luis cataldi-siggraph 2015Luis cataldi-siggraph 2015
Luis cataldi-siggraph 2015
 
Getting Started with C/C# Game Development Part 1
Getting Started with C/C# Game Development Part 1Getting Started with C/C# Game Development Part 1
Getting Started with C/C# Game Development Part 1
 
Introduction to wave engine
Introduction to wave engineIntroduction to wave engine
Introduction to wave engine
 
Ue4 siggraph-nick-whiting
Ue4 siggraph-nick-whitingUe4 siggraph-nick-whiting
Ue4 siggraph-nick-whiting
 
Luis Catald IGDA Sept 2015
Luis Catald IGDA Sept 2015Luis Catald IGDA Sept 2015
Luis Catald IGDA Sept 2015
 
沖縄まで踊りに来たぜ!VR/AR/MR最前線
沖縄まで踊りに来たぜ!VR/AR/MR最前線沖縄まで踊りに来たぜ!VR/AR/MR最前線
沖縄まで踊りに来たぜ!VR/AR/MR最前線
 
Luis cataldi unreal engine for educators
Luis cataldi   unreal engine for educatorsLuis cataldi   unreal engine for educators
Luis cataldi unreal engine for educators
 
VR/AR/MRってなんですか?
VR/AR/MRってなんですか?VR/AR/MRってなんですか?
VR/AR/MRってなんですか?
 
Disruptive Innovation
Disruptive InnovationDisruptive Innovation
Disruptive Innovation
 
Apache Yetus: Intro to Precommit for HBase Contributors
Apache Yetus: Intro to Precommit for HBase ContributorsApache Yetus: Intro to Precommit for HBase Contributors
Apache Yetus: Intro to Precommit for HBase Contributors
 
Apache Yetus: Helping Solve the Last Mile Problem
Apache Yetus: Helping Solve the Last Mile ProblemApache Yetus: Helping Solve the Last Mile Problem
Apache Yetus: Helping Solve the Last Mile Problem
 
Kim libreri-siggraph 2015
Kim libreri-siggraph 2015Kim libreri-siggraph 2015
Kim libreri-siggraph 2015
 
Hadoop Operations at LinkedIn
Hadoop Operations at LinkedInHadoop Operations at LinkedIn
Hadoop Operations at LinkedIn
 
Unity L01 - Game Development
Unity L01 - Game DevelopmentUnity L01 - Game Development
Unity L01 - Game Development
 
EA: Optimization of mobile Unity application
EA: Optimization of mobile Unity applicationEA: Optimization of mobile Unity application
EA: Optimization of mobile Unity application
 
15 vr trends 2017 yariv levski
15 vr trends 2017 yariv levski15 vr trends 2017 yariv levski
15 vr trends 2017 yariv levski
 

More from ElifTech

Go Concurrency Patterns
Go Concurrency PatternsGo Concurrency Patterns
Go Concurrency PatternsElifTech
 
Go Concurrency Basics
Go Concurrency Basics Go Concurrency Basics
Go Concurrency Basics ElifTech
 
Domain Logic Patterns
Domain Logic PatternsDomain Logic Patterns
Domain Logic PatternsElifTech
 
Dive into .Net Core framework
Dive into .Net Core framework Dive into .Net Core framework
Dive into .Net Core framework ElifTech
 
VR digest. August 2018
VR digest. August 2018VR digest. August 2018
VR digest. August 2018ElifTech
 
JS digest. July 2018
JS digest.  July 2018JS digest.  July 2018
JS digest. July 2018ElifTech
 
VR digest. July 2018
VR digest. July 2018VR digest. July 2018
VR digest. July 2018ElifTech
 
IoT digest. July 2018
IoT digest. July 2018IoT digest. July 2018
IoT digest. July 2018ElifTech
 
VR digest. June 2018
VR digest. June 2018VR digest. June 2018
VR digest. June 2018ElifTech
 
IoT digest. June 2018
IoT digest. June 2018IoT digest. June 2018
IoT digest. June 2018ElifTech
 
IoT digest. May 2018
IoT digest. May 2018IoT digest. May 2018
IoT digest. May 2018ElifTech
 
Object Detection with Tensorflow
Object Detection with TensorflowObject Detection with Tensorflow
Object Detection with TensorflowElifTech
 
VR digest. May 2018
VR digest. May 2018VR digest. May 2018
VR digest. May 2018ElifTech
 
Polymer: brief introduction
Polymer: brief introduction Polymer: brief introduction
Polymer: brief introduction ElifTech
 
JS digest. April 2018
JS digest. April 2018JS digest. April 2018
JS digest. April 2018ElifTech
 
VR digest. April, 2018
VR digest. April, 2018 VR digest. April, 2018
VR digest. April, 2018 ElifTech
 
IoT digest. April 2018
IoT digest. April 2018IoT digest. April 2018
IoT digest. April 2018ElifTech
 
IoT digest. March 2018
IoT digest. March 2018IoT digest. March 2018
IoT digest. March 2018ElifTech
 
VR digest. March, 2018
VR digest. March, 2018VR digest. March, 2018
VR digest. March, 2018ElifTech
 
VR digest. February, 2018
VR digest. February, 2018VR digest. February, 2018
VR digest. February, 2018ElifTech
 

More from ElifTech (20)

Go Concurrency Patterns
Go Concurrency PatternsGo Concurrency Patterns
Go Concurrency Patterns
 
Go Concurrency Basics
Go Concurrency Basics Go Concurrency Basics
Go Concurrency Basics
 
Domain Logic Patterns
Domain Logic PatternsDomain Logic Patterns
Domain Logic Patterns
 
Dive into .Net Core framework
Dive into .Net Core framework Dive into .Net Core framework
Dive into .Net Core framework
 
VR digest. August 2018
VR digest. August 2018VR digest. August 2018
VR digest. August 2018
 
JS digest. July 2018
JS digest.  July 2018JS digest.  July 2018
JS digest. July 2018
 
VR digest. July 2018
VR digest. July 2018VR digest. July 2018
VR digest. July 2018
 
IoT digest. July 2018
IoT digest. July 2018IoT digest. July 2018
IoT digest. July 2018
 
VR digest. June 2018
VR digest. June 2018VR digest. June 2018
VR digest. June 2018
 
IoT digest. June 2018
IoT digest. June 2018IoT digest. June 2018
IoT digest. June 2018
 
IoT digest. May 2018
IoT digest. May 2018IoT digest. May 2018
IoT digest. May 2018
 
Object Detection with Tensorflow
Object Detection with TensorflowObject Detection with Tensorflow
Object Detection with Tensorflow
 
VR digest. May 2018
VR digest. May 2018VR digest. May 2018
VR digest. May 2018
 
Polymer: brief introduction
Polymer: brief introduction Polymer: brief introduction
Polymer: brief introduction
 
JS digest. April 2018
JS digest. April 2018JS digest. April 2018
JS digest. April 2018
 
VR digest. April, 2018
VR digest. April, 2018 VR digest. April, 2018
VR digest. April, 2018
 
IoT digest. April 2018
IoT digest. April 2018IoT digest. April 2018
IoT digest. April 2018
 
IoT digest. March 2018
IoT digest. March 2018IoT digest. March 2018
IoT digest. March 2018
 
VR digest. March, 2018
VR digest. March, 2018VR digest. March, 2018
VR digest. March, 2018
 
VR digest. February, 2018
VR digest. February, 2018VR digest. February, 2018
VR digest. February, 2018
 

Recently uploaded

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 

Recently uploaded (20)

UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 

Three JS, Unreal, Unity. VR/AR/MR without 9 circles of hell

  • 1. Three JS, Unreal, Unity. VR/AR without 9 circles of hell by Marina Kolesnichenko, Software Engineer at ElifTech
  • 2. Three.js cookbook Three.js is a cross-browser JavaScript library/API used to create and display animated 3D computer graphics in a web browser. Three.js uses WebGL.
  • 3. Quick start http://threejs.org/ Click the “Download” link on the left side of your screen. Once the zip has finished downloading, open it up and go to the build folder. Inside, you’ll find a file called three.min.js and, if you’re following along, you should copy this file into your local development directory. What about NPM? npm install three But this library version is 'limited' at moment. So I recommend download library from official site.
  • 7. More power! OBJLoader A loader for loading an .obj resource.
  • 8. Basic var loader = new THREE.OBJLoader(); // load a resource loader.load( // resource URL 'models/monster.obj', // function when resource is loaded function ( object ) { scene.add( object ); } );
  • 9. With .mtl loadModel(model, options, done) { let name = model.split("/").pop(); let path = `${model.substring(0, model.lastIndexOf("/"))}/`; this.mtl.setPath(path); this.mtl.load(`${name}.mtl`, (materials) => { materials.preload(); for (let key in materials.materials) { let material = materials.materials[key]; material.shading = THREE.SmoothShading; material.side = THREE.DoubleSide; } this.obj.setMaterials(materials); this.obj.setPath(path); this.obj.load(`${name}.obj`, (object) => { object.name = options.name || "Scene"; object.position.fromArray(options.position || [0, 0, 0]); object.rotation.fromArray(options.rotation || [0, 0, 0]); object.scale.set(options.scale || 1, options.scale || 1, options.scale || 1); object.traverse((child) => { if (child instanceof THREE.Mesh) { child.current = {}; child.original = {}; child.original.material = child.material.clone(); child.receiveShadow = false; child.castShadow = true; } }); done(object, materials.materials); }); }); }
  • 10. What? Material Library File (.mtl) Material library files contain one or more material definitions, each of which includes the color, texture, and reflection map of individual materials. These are applied to the surfaces and vertices of objects. Material files are stored in ASCII format and have the .mtl extension.
  • 11. Render scene render() { if (this.mode == 'vr') { this.stereo.render(this.scene, this.camera); } else { this.renderer.render(this.scene, this.camera); } window.requestAnimationFrame(() => { this.controls.update(); this.update(delta); this.render(); }); }
  • 13. Workflow new THREE.BoxGeometry new THREE.MeshBasicMaterial ( { color: 0xff0000, wireframe: true } )
  • 16. Audio this.camera.listener = new THREE.AudioListener(); this.camera.listener.name = 'Audio Listener'; this.camera.add(this.camera.listener);
  • 18. Shaders A Shader is a piece of code that runs directly on the GPU. Most modern devices have powerful GPUs designed to handle graphics effects without taxing the CPU. Pixels Vertex Shaders or Babylon...
  • 19. Pixels Pixel Shaders modify or draw the pixels in a scene. They are used to render a 3D scene into pixels, and also typically used to add lighting and other effects to a 3D scene.
  • 20. Pixels Shaders that draw an image or texture directly. These types of shaders can be loaded into a THREE.ShaderMaterial to give cool textures to 3D objects.
  • 21. Pixels Shaders that modify another image or texture. These allow you to do post-processing on an existing texture, for example to add a glow or blur to a 3D scene.
  • 22. Vertex Vertex shaders generate or modify 3D geometry by manipulating its vertices.
  • 26. VR
  • 27. VR this.stereo = new THREE.OculusRiftEffect(this.renderer); let hmd = this.stereo.getHMD(); hmd.hResolution = this.width; hmd.vResolution = this.height; this.stereo.setHMD(hmd); this.stereo.setSize(this.width, this.height); this.stereo.render(this.scene, this.camera);
  • 28. VR
  • 29. VR
  • 30. Raycaster this.raycaster = new THREE.Raycaster(); this.raycaster.setFromCamera(new THREE.Vector2(), this.camera); let intersects = this.raycaster.intersectObject(object, true);
  • 31. OSGJS OSGJS is based on OpenSceneGraph API, which itself is based on a few concepts that allow for a solid grasp around the whole library once and for all, and those are mandatory in order to dive into code.
  • 32. Difference viewer = new osgViewer.Viewer(canvas, {antialias : true, alpha: true }); rotate = new osg.MatrixTransform(); viewer.setupManipulator(new osgGA.OrbitManipulator()); viewer.getManipulator().setDistance(20.0); viewer.run();
  • 33. Why not? 1. FPS and freezes 2. Limited scene 3. Difficult work with animation and shaders
  • 35. Unreal Engine uses C++ and Unity uses mostly C# or JavaScript. Unreal Engine has Blueprint visual scripting. Technically you don't ever need to write a single line of code.
  • 36. All pointers of objects that are at the level should point to objects at the level and objects outside the level can't have pointers pointing to objects at the level.
  • 37. VR Virtual reality (VR), which can be referred to as immersive multimedia or computer-simulated reality, replicates an environment that simulates a physical presence in places in the real world or an imagined world, allowing the user to interact in that world.
  • 38. VR
  • 39. VR
  • 40. VR
  • 42. AR Augmented reality (AR) is a live, direct or indirect view of a physical, real- world environment whose elements are augmented (or supplemented) by computer-generated sensory input such as sound, video, graphics or GPS data
  • 43. VR, ok! AR, ok! MR O_O? Mixed reality - is the merging of real and virtual worlds to produce new environments and visualisations where physical and digital objects co-exist and interact in real time. Mixed reality is an overlay of synthetic content on the real world that is anchored to and interacts with the real world—picture surgeons overlaying virtual ultrasound images on their patient while performing an operation, for example. The key characteristic of MR is that the synthetic content and the real-world content are able to react to each other in real time.
  • 44.
  • 45. WOW!
  • 46. Overdraw Overdraw view allows you to see what objects are drawn on top of another, which is a waste of GPU time. Look at reducing overdraw as much as possible. You can view overdraw in the Scene View by using the Scene View Control Bar.
  • 48. Occlusion Occlusion Culling stops objects from being rendered if they cannot be seen. For example, we don’t want to render another room if a door is closed and it cannot be seen.
  • 50. Rendering Approximating your own distortion solution, even when it “looks about right,” is often discomforting for users. Any deviation from the optical flow that accompanies real world head movement creates oculomotor issues and bodily discomfort. Consider supersampling and/or anti-aliasing to remedy low apparent resolution, which will appear worst at the center of each eye’s screen. Tabu
  • 51. Minimizing Latency Your code should run at a frame rate equal to or greater than the Rift display refresh rate, v-synced and unbuffered. Lag and dropped frames produce judder which is discomforting in VR. Ideally, target 20ms or less motion-to-photon latency (measurable with the Rift’s built-in latency tester). Organize your code to minimize the time from sensor fusion (reading the Rift sensors) to rendering. Decrease eye-render buffer resolution to save video memory and increase frame rate. Avoid visuals that upset the user’s sense of stability in their environment. Rotating or moving the horizon line or other large components of the user’s environment in conflict with the user’s real- world self-motion (or lack thereof) can be discomforting.
  • 52. Feel free to ask questions in the comments
  • 53. Thank you for attention! Find us at eliftech.com Have a question? Contact us: info@eliftech.com