SlideShare a Scribd company logo
1 of 27
Download to read offline
Sceneform SDK
In practice
Illya Rodin, CTO
ROAR AR Platform
Get started
Use cases:
1. Drawing 3D
scene
2. Item 1 + SLAM
(require
support ARCore)
Requirements:
1.Android SDK
version >=24
2.Java 8
3.*Sceneform Gradle
Plugin
4.*Google Sceneform
Tools for Android
Studio
5.*com.google.ar.sc
eneform:core
Support:
1. Shapes (sphere,
cylinder, cube)
2. 2D Android View
3. 3D models
(OBJ/FBX/GLTF/G
LB)
4. *Android
Property
animations or
FBX 2016/17+)
Scene and Nodes
Scene
Sun Camera AnchorNode AugmentedFaceNode
SkeletonNode
Special nodes
TransformableNode
World Vs Local Coord
World Coord.
Anchor A Coord.
(Local Coord.)
Anchor B Coord.
(Local Coord.)
Node Transformation
● World/LocalPosition
● World/LocalRotation
● World/LocalScale
● Quaternion(float x, float y, float z, float w)
● sqrt(x*x + y*y + z*z + w*w) = 1
● Quaternion.axisAngle(Vector3 axis, float degrees)
Renderable:shapes
Sphere
ShapeFactory.makeSphere(0.1f,
Vector3(0.0f, 0.15f,
0.0f),material))
Cylinder
ShapeFactory.makeCylinder(0.1f,
0.3f,Vector3(0.0f, 0.15f,
0.0f),material))
Cube
ShapeFactory.makeCube(Vector3(0.
2f, 0.2f, 0.2f),Vector3(0.0f,
0.15f, 0.0f),,material))
Renderable:ViewRendarable
ViewRenderable.builder()
.setView(this, R.layout.view)
.build()
.thenAccept(...);
1 meter = 250 dp
ViewSizer:
● DpToMetersViewSizer
● FixedWidthViewSizer
● FixedHeightViewSizer
Sceneform Tools Plugin / Google Sceneform Tools(I)
Import 3D Assets
3D Model Assets:
● OBJ
● FBX
● GLTF/GLB
Dependencies:
● MTL
● BIN
● PNG/JPG/e.t.c.
Sceneform Tools Plugin / Google Sceneform Tools(II)
sceneform.asset('sampledata/models/a
ndy_dance.fbx','default',
'sampledata/models/andy_dance.sfa',
'src/main/res/raw/andy_dance',
['sampledata/models/andy_wave_r.fbx'
,
'sampledata/models/andy_wave_l.fbx']
)
3D Model + Dependencies
Sceneform Asset Definition
(.sfa)
Sceneform Binary Asset
(.sfb)
Renderable:ModelRendarable
From samples folder
ModelRenderable.builder()
.setSource(this, Uri.parse("andy.sfb"))
//.setSource(this, R.raw.andy)
.build()
.thenAccept(....)
.exceptionally(...);
In runtime (only gltf/glb)
<uses-permission android:name="android.permission.INTERNET"/>
ModelRenderable.builder()
.setSource(this, RenderableSource.builder().setSource(this,
Uri.parse(GLTF_ASSET),RenderableSource.SourceType.GLTF2)
.build()).setRegistryId(GLTF_ASSET)
.build()
.thenAccept(...)
.exceptionally(...);
Sceneform Asset Definition
materials[].parameters
Default:
● OBJ
● FBX
● glTF
Custom: *.mat
materials[].source
model.attributes
model.file
model.scale
model.recenter
samplers[]
Sceneform Material (I)
A material defines the visual appearance of a surface.
To completely describe and render a surface, a material
provides the following information:
● Material model
● Set of use-controllable named parameters
● Raster state (blending mode, backface culling,
etc.)
● Vertex shader code
● Fragment shader code
material {
// material properties
}
vertex {
// vertex shader, optional
}
fragment {
// fragment shader
}
Sceneform Material (II)
Shading model:
● Lit
● Cloth
● Unlit:
material {
name : Skybox,
parameters : [
{
type : sampler2d,
name : skybox
}
],
variables : [ eyeDirection ],
vertexDomain : device,
depthWrite : false,
shadingModel : unlit
}
fragment {
void material(inout MaterialInputs material) {
prepareMaterial(material);
float theta = acos(variable_eyeDirection.y);
float phi = atan(variable_eyeDirection.z / variable_eyeDirection.x)
+
(variable_eyeDirection.x > 0.0 ? 0.0 : PI);
material.baseColor = texture(materialParams_skybox,
vec2((phi + PI / 2.0) / (2.0 * PI), theta / PI));
}
}
vertex {
void materialVertex(inout MaterialVertexInputs material) {
float3 p = getPosition().xyz;
float3 u = mulMat4x4Float3(getViewFromClipMatrix(), p).xyz;
material.eyeDirection.xyz =
mulMat3x3Float3(getWorldFromViewMatrix(), u);
}
}
Textures
val texture: CompletableFuture<Texture> = Texture.builder()
.setSource(context, Uri.parse(uri))
.setUsage(Texture.Usage.DATA)
.setSampler(
Texture.Sampler.builder()
.setMagFilter(Sampler.MagFilter.LINEAR)
.setMinFilter(Sampler.MinFilter.LINEAR_MIPMAP_LINEAR)
.build()
).build()
//--------------------------------------------------------------------------------------------------------------------------------------------------//
renderable.material.setTexture(“parameterName”, texture)
Filament
Filament is a real-time physically
based rendering engine for Android,
iOS, Linux, macOS, Windows, and WebGL.
It is designed to be as small as
possible and as efficient as possible
on Android.
● OpenGL 4.1+ for Linux, macOS and Windows
● OpenGL ES 3.0+ for Android and iOS
● Metal for macOS and iOS
● Vulkan 1.0 for Android, Linux, macOS and iOS (with
MoltenVk), and Windows
● WebGL 2.0 for all platforms
Light & Shadow
Animation(I)
File format: FBX 2016/2017 or later
Axis conversion: Up axis is Y
Scale factor: Centimeters
Required geometry settings:
Smoothing groups
Smooth mesh
Referenced asset content
Recommended geometry settings:
Tangents and binormals
Triangulate
NURBS
Animation: enabled
Deformed models settings:
Deformed models
Skins
private void onPlayAnimation() {
if (animator == null || !animator.isRunning()) {
AnimationData data =
andyRenderable.getAnimationData(nextAnimation);
nextAnimation = (nextAnimation + 1) %
andyRenderable.getAnimationDataCount();
animator = new ModelAnimator(data, andyRenderable);
animator.start();
}
Animation(II)
private static ObjectAnimator createAnimator(boolean clockwise, float axisTiltDeg) {
Quaternion[] orientations = new Quaternion[4];
//-------------------------------------------------------//
ObjectAnimator orbitAnimation = new ObjectAnimator();
orbitAnimation.setObjectValues((Object[]) orientations);
orbitAnimation.setPropertyName("localRotation");
//------------------------------------------------------/
return orbitAnimation;
}
SLAM(Simultaneous localization and mapping)
ArCore + SceneformUX
● SceneView
● ArSceneView
● ArFragment
○ Check ARCore version
○ Check permissions
○ Session initialization and
configuration
○ Handle gestures
Cloud Anchors
Image Recognition
● Up to 1000 reference images.
● Up to 20 images simultaneously in the environment, but it cannot
track multiple instances of the same image.
● The physical image in the environment must be at least 15cm x 15cm
and must be flat
● Once tracked, ARCore provides estimates for position, orientation,
and physical size. These estimates are continuously refined as
ARCore gathers more data.
● ARCore cannot track a moving image, but it can resume tracking
that image after it stops moving.
● All tracking happens on the device, so no internet connection is
required. Reference images can be updated on-device or over the
network without requiring an app update.
Augmented Faces
ViroCore SDK
● *Free
● Android API 21+
● ReactNative
● AR
● VR
● Support glTF and *FBX
animation
● PBR, Physics,
Portals, Particle
Effects, Views,
e.t.c.
Q&A
Resources
● https://developers.google.com/ar/develop/java/sceneform/
● https://proandroiddev.com/@harivigneshjayapalan
● https://github.com/google/filament
● https://google.github.io/filament/Filament.md.html
● https://developers.google.com/ar/
● https://virocore.viromedia.com/

More Related Content

What's hot

Функциональный микроскоп: линзы в C++
Функциональный микроскоп: линзы в C++Функциональный микроскоп: линзы в C++
Функциональный микроскоп: линзы в C++Platonov Sergey
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentationsharp-blade
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸Hao Peiqiang
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityWithTheBest
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsMichael Hackstein
 
openFrameworks 007 - utils
openFrameworks 007 - utilsopenFrameworks 007 - utils
openFrameworks 007 - utilsroxlu
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 CanvasHenry Osborne
 
Neu und heiß! ARKit is heiß - ARKit2 ist heißer
Neu und heiß! ARKit is heiß - ARKit2 ist heißerNeu und heiß! ARKit is heiß - ARKit2 ist heißer
Neu und heiß! ARKit is heiß - ARKit2 ist heißerOrtwin Gentz
 
오브젝트C(pdf)
오브젝트C(pdf)오브젝트C(pdf)
오브젝트C(pdf)sunwooindia
 
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)François Sarradin
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)JAINAM KAPADIYA
 

What's hot (19)

2011 11-mozcamp
2011 11-mozcamp2011 11-mozcamp
2011 11-mozcamp
 
Efek daun
Efek daunEfek daun
Efek daun
 
Функциональный микроскоп: линзы в C++
Функциональный микроскоп: линзы в C++Функциональный микроскоп: линзы в C++
Функциональный микроскоп: линзы в C++
 
Paperjs presentation
Paperjs presentationPaperjs presentation
Paperjs presentation
 
Sigma type
Sigma typeSigma type
Sigma type
 
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
iPhone/iPad开发讲座 第五讲 定制视图和多点触摸
 
Maximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unityMaximizing performance of 3 d user generated assets in unity
Maximizing performance of 3 d user generated assets in unity
 
Having fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.jsHaving fun with graphs, a short introduction to D3.js
Having fun with graphs, a short introduction to D3.js
 
openFrameworks 007 - utils
openFrameworks 007 - utilsopenFrameworks 007 - utils
openFrameworks 007 - utils
 
Intro to HTML5 Canvas
Intro to HTML5 CanvasIntro to HTML5 Canvas
Intro to HTML5 Canvas
 
Drawing with the HTML5 Canvas
Drawing with the HTML5 CanvasDrawing with the HTML5 Canvas
Drawing with the HTML5 Canvas
 
GLSL
GLSLGLSL
GLSL
 
Neu und heiß! ARKit is heiß - ARKit2 ist heißer
Neu und heiß! ARKit is heiß - ARKit2 ist heißerNeu und heiß! ARKit is heiß - ARKit2 ist heißer
Neu und heiß! ARKit is heiß - ARKit2 ist heißer
 
Es6 overview
Es6 overviewEs6 overview
Es6 overview
 
오브젝트C(pdf)
오브젝트C(pdf)오브젝트C(pdf)
오브젝트C(pdf)
 
OpenGL 4.4 Reference Card
OpenGL 4.4 Reference CardOpenGL 4.4 Reference Card
OpenGL 4.4 Reference Card
 
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
FLATMAP ZAT SHIT : les monades expliquées aux geeks (Devoxx France 2013)
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 

Similar to Sceneform SDK на практиці - UA Mobile 2019

The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)Domenic Denicola
 
426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer Tools426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer ToolsMark Billinghurst
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android GamesPlatty Soft
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DRoman Protsyk
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLgerbille
 
Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Mateusz Bryła
 
Introduction to threejs
Introduction to threejsIntroduction to threejs
Introduction to threejsGareth Marland
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconftutorialsruby
 
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptAntoJoseph36
 
Following are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdfFollowing are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdfanithareadymade
 
Introduction to open gl in android droidcon - slides
Introduction to open gl in android   droidcon - slidesIntroduction to open gl in android   droidcon - slides
Introduction to open gl in android droidcon - slidestamillarasan
 
Migrating to Angular 2
Migrating to Angular 2Migrating to Angular 2
Migrating to Angular 2FITC
 
Cocos2d Performance Tips
Cocos2d Performance TipsCocos2d Performance Tips
Cocos2d Performance TipsKeisuke Hata
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScriptersgerbille
 

Similar to Sceneform SDK на практиці - UA Mobile 2019 (20)

The State of JavaScript (2015)
The State of JavaScript (2015)The State of JavaScript (2015)
The State of JavaScript (2015)
 
426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer Tools426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer Tools
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3D
 
Leaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGLLeaving Flatland: getting started with WebGL
Leaving Flatland: getting started with WebGL
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
Recoil at Codete Webinars #3
Recoil at Codete Webinars #3Recoil at Codete Webinars #3
Recoil at Codete Webinars #3
 
Introduction to threejs
Introduction to threejsIntroduction to threejs
Introduction to threejs
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
building_games_with_ruby_rubyconf
building_games_with_ruby_rubyconfbuilding_games_with_ruby_rubyconf
building_games_with_ruby_rubyconf
 
Ali.pptx
Ali.pptxAli.pptx
Ali.pptx
 
Ali.pptx
Ali.pptxAli.pptx
Ali.pptx
 
COLLADA & WebGL
COLLADA & WebGLCOLLADA & WebGL
COLLADA & WebGL
 
FLAR Workflow
FLAR WorkflowFLAR Workflow
FLAR Workflow
 
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.pptDESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
 
Following are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdfFollowing are the changes mentioned in bold in order to obtain the r.pdf
Following are the changes mentioned in bold in order to obtain the r.pdf
 
Introduction to open gl in android droidcon - slides
Introduction to open gl in android   droidcon - slidesIntroduction to open gl in android   droidcon - slides
Introduction to open gl in android droidcon - slides
 
Migrating to Angular 2
Migrating to Angular 2Migrating to Angular 2
Migrating to Angular 2
 
Cocos2d Performance Tips
Cocos2d Performance TipsCocos2d Performance Tips
Cocos2d Performance Tips
 
Webgl para JavaScripters
Webgl para JavaScriptersWebgl para JavaScripters
Webgl para JavaScripters
 

More from UA Mobile

Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...UA Mobile
 
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...Декларативное программирование клиент-серверных приложений на андроид - UA Mo...
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...UA Mobile
 
Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019UA Mobile
 
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019UA Mobile
 
Google Wear OS watch faces and applications development - UA Mobile 2019
Google Wear OS watch faces and applications development - UA Mobile 2019Google Wear OS watch faces and applications development - UA Mobile 2019
Google Wear OS watch faces and applications development - UA Mobile 2019UA Mobile
 
Історія декількох проектів та що в них пішло не так - UA Mobile 2019
Історія декількох проектів та що в них пішло не так - UA Mobile 2019Історія декількох проектів та що в них пішло не так - UA Mobile 2019
Історія декількох проектів та що в них пішло не так - UA Mobile 2019UA Mobile
 
Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019UA Mobile
 
Managing State in Reactive applications - UA Mobile 2019
Managing State in Reactive applications - UA Mobile 2019Managing State in Reactive applications - UA Mobile 2019
Managing State in Reactive applications - UA Mobile 2019UA Mobile
 
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019UA Mobile
 
Актуальні практики дизайну мобільних додатків - UA Mobile 2019
Актуальні практики дизайну мобільних додатків - UA Mobile 2019Актуальні практики дизайну мобільних додатків - UA Mobile 2019
Актуальні практики дизайну мобільних додатків - UA Mobile 2019UA Mobile
 
До чого прикладати Docker в Android? - UA Mobile 2019
До чого прикладати Docker в Android? - UA Mobile 2019До чого прикладати Docker в Android? - UA Mobile 2019
До чого прикладати Docker в Android? - UA Mobile 2019UA Mobile
 
Building your Flutter apps using Redux - UA Mobile 2019
Building your Flutter apps using Redux - UA Mobile 2019Building your Flutter apps using Redux - UA Mobile 2019
Building your Flutter apps using Redux - UA Mobile 2019UA Mobile
 
Optional. Tips and Tricks - UA Mobile 2019
Optional. Tips and Tricks - UA Mobile 2019Optional. Tips and Tricks - UA Mobile 2019
Optional. Tips and Tricks - UA Mobile 2019UA Mobile
 
Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...UA Mobile
 
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019UA Mobile
 
Flutter: No more boring apps! - UA Mobile 2019
Flutter: No more boring apps! - UA Mobile 2019Flutter: No more boring apps! - UA Mobile 2019
Flutter: No more boring apps! - UA Mobile 2019UA Mobile
 
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019UA Mobile
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019UA Mobile
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.UA Mobile
 
Augmented reality on Android. UA Mobile 2017.
Augmented reality on Android. UA Mobile 2017.Augmented reality on Android. UA Mobile 2017.
Augmented reality on Android. UA Mobile 2017.UA Mobile
 

More from UA Mobile (20)

Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...
 
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...Декларативное программирование клиент-серверных приложений на андроид - UA Mo...
Декларативное программирование клиент-серверных приложений на андроид - UA Mo...
 
Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019Leave your Room behind - UA Mobile 2019
Leave your Room behind - UA Mobile 2019
 
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019
OpenId and OAuth2: Rear, Medium, Well Done - UA Mobile 2019
 
Google Wear OS watch faces and applications development - UA Mobile 2019
Google Wear OS watch faces and applications development - UA Mobile 2019Google Wear OS watch faces and applications development - UA Mobile 2019
Google Wear OS watch faces and applications development - UA Mobile 2019
 
Історія декількох проектів та що в них пішло не так - UA Mobile 2019
Історія декількох проектів та що в них пішло не так - UA Mobile 2019Історія декількох проектів та що в них пішло не так - UA Mobile 2019
Історія декількох проектів та що в них пішло не так - UA Mobile 2019
 
Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019Working effectively with ViewModels and TDD - UA Mobile 2019
Working effectively with ViewModels and TDD - UA Mobile 2019
 
Managing State in Reactive applications - UA Mobile 2019
Managing State in Reactive applications - UA Mobile 2019Managing State in Reactive applications - UA Mobile 2019
Managing State in Reactive applications - UA Mobile 2019
 
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019
Ідіоматична ін'єкція залежностей на Kotlin без фреймворків - UA Mobile2019
 
Актуальні практики дизайну мобільних додатків - UA Mobile 2019
Актуальні практики дизайну мобільних додатків - UA Mobile 2019Актуальні практики дизайну мобільних додатків - UA Mobile 2019
Актуальні практики дизайну мобільних додатків - UA Mobile 2019
 
До чого прикладати Docker в Android? - UA Mobile 2019
До чого прикладати Docker в Android? - UA Mobile 2019До чого прикладати Docker в Android? - UA Mobile 2019
До чого прикладати Docker в Android? - UA Mobile 2019
 
Building your Flutter apps using Redux - UA Mobile 2019
Building your Flutter apps using Redux - UA Mobile 2019Building your Flutter apps using Redux - UA Mobile 2019
Building your Flutter apps using Redux - UA Mobile 2019
 
Optional. Tips and Tricks - UA Mobile 2019
Optional. Tips and Tricks - UA Mobile 2019Optional. Tips and Tricks - UA Mobile 2019
Optional. Tips and Tricks - UA Mobile 2019
 
Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...Designing iOS+Android project without using multiplatform frameworks - UA Mob...
Designing iOS+Android project without using multiplatform frameworks - UA Mob...
 
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
Бібліотеки та Інструменти на сторожі коду - UA Mobile 2019
 
Flutter: No more boring apps! - UA Mobile 2019
Flutter: No more boring apps! - UA Mobile 2019Flutter: No more boring apps! - UA Mobile 2019
Flutter: No more boring apps! - UA Mobile 2019
 
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019
Долаючи прірву між дизайнерами та розробниками - UA Mobile 2019
 
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
Multiplatform shared codebase with Kotlin/Native - UA Mobile 2019
 
Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.Coroutines in Kotlin. UA Mobile 2017.
Coroutines in Kotlin. UA Mobile 2017.
 
Augmented reality on Android. UA Mobile 2017.
Augmented reality on Android. UA Mobile 2017.Augmented reality on Android. UA Mobile 2017.
Augmented reality on Android. UA Mobile 2017.
 

Sceneform SDK на практиці - UA Mobile 2019

  • 1. Sceneform SDK In practice Illya Rodin, CTO ROAR AR Platform
  • 2. Get started Use cases: 1. Drawing 3D scene 2. Item 1 + SLAM (require support ARCore) Requirements: 1.Android SDK version >=24 2.Java 8 3.*Sceneform Gradle Plugin 4.*Google Sceneform Tools for Android Studio 5.*com.google.ar.sc eneform:core Support: 1. Shapes (sphere, cylinder, cube) 2. 2D Android View 3. 3D models (OBJ/FBX/GLTF/G LB) 4. *Android Property animations or FBX 2016/17+)
  • 3. Scene and Nodes Scene Sun Camera AnchorNode AugmentedFaceNode SkeletonNode Special nodes TransformableNode
  • 4. World Vs Local Coord World Coord. Anchor A Coord. (Local Coord.) Anchor B Coord. (Local Coord.)
  • 5. Node Transformation ● World/LocalPosition ● World/LocalRotation ● World/LocalScale ● Quaternion(float x, float y, float z, float w) ● sqrt(x*x + y*y + z*z + w*w) = 1 ● Quaternion.axisAngle(Vector3 axis, float degrees)
  • 7. Renderable:ViewRendarable ViewRenderable.builder() .setView(this, R.layout.view) .build() .thenAccept(...); 1 meter = 250 dp ViewSizer: ● DpToMetersViewSizer ● FixedWidthViewSizer ● FixedHeightViewSizer
  • 8. Sceneform Tools Plugin / Google Sceneform Tools(I) Import 3D Assets 3D Model Assets: ● OBJ ● FBX ● GLTF/GLB Dependencies: ● MTL ● BIN ● PNG/JPG/e.t.c.
  • 9. Sceneform Tools Plugin / Google Sceneform Tools(II) sceneform.asset('sampledata/models/a ndy_dance.fbx','default', 'sampledata/models/andy_dance.sfa', 'src/main/res/raw/andy_dance', ['sampledata/models/andy_wave_r.fbx' , 'sampledata/models/andy_wave_l.fbx'] ) 3D Model + Dependencies Sceneform Asset Definition (.sfa) Sceneform Binary Asset (.sfb)
  • 10. Renderable:ModelRendarable From samples folder ModelRenderable.builder() .setSource(this, Uri.parse("andy.sfb")) //.setSource(this, R.raw.andy) .build() .thenAccept(....) .exceptionally(...); In runtime (only gltf/glb) <uses-permission android:name="android.permission.INTERNET"/> ModelRenderable.builder() .setSource(this, RenderableSource.builder().setSource(this, Uri.parse(GLTF_ASSET),RenderableSource.SourceType.GLTF2) .build()).setRegistryId(GLTF_ASSET) .build() .thenAccept(...) .exceptionally(...);
  • 11. Sceneform Asset Definition materials[].parameters Default: ● OBJ ● FBX ● glTF Custom: *.mat materials[].source model.attributes model.file model.scale model.recenter samplers[]
  • 12. Sceneform Material (I) A material defines the visual appearance of a surface. To completely describe and render a surface, a material provides the following information: ● Material model ● Set of use-controllable named parameters ● Raster state (blending mode, backface culling, etc.) ● Vertex shader code ● Fragment shader code material { // material properties } vertex { // vertex shader, optional } fragment { // fragment shader }
  • 13. Sceneform Material (II) Shading model: ● Lit ● Cloth ● Unlit: material { name : Skybox, parameters : [ { type : sampler2d, name : skybox } ], variables : [ eyeDirection ], vertexDomain : device, depthWrite : false, shadingModel : unlit } fragment { void material(inout MaterialInputs material) { prepareMaterial(material); float theta = acos(variable_eyeDirection.y); float phi = atan(variable_eyeDirection.z / variable_eyeDirection.x) + (variable_eyeDirection.x > 0.0 ? 0.0 : PI); material.baseColor = texture(materialParams_skybox, vec2((phi + PI / 2.0) / (2.0 * PI), theta / PI)); } } vertex { void materialVertex(inout MaterialVertexInputs material) { float3 p = getPosition().xyz; float3 u = mulMat4x4Float3(getViewFromClipMatrix(), p).xyz; material.eyeDirection.xyz = mulMat3x3Float3(getWorldFromViewMatrix(), u); } }
  • 14. Textures val texture: CompletableFuture<Texture> = Texture.builder() .setSource(context, Uri.parse(uri)) .setUsage(Texture.Usage.DATA) .setSampler( Texture.Sampler.builder() .setMagFilter(Sampler.MagFilter.LINEAR) .setMinFilter(Sampler.MinFilter.LINEAR_MIPMAP_LINEAR) .build() ).build() //--------------------------------------------------------------------------------------------------------------------------------------------------// renderable.material.setTexture(“parameterName”, texture)
  • 15. Filament Filament is a real-time physically based rendering engine for Android, iOS, Linux, macOS, Windows, and WebGL. It is designed to be as small as possible and as efficient as possible on Android. ● OpenGL 4.1+ for Linux, macOS and Windows ● OpenGL ES 3.0+ for Android and iOS ● Metal for macOS and iOS ● Vulkan 1.0 for Android, Linux, macOS and iOS (with MoltenVk), and Windows ● WebGL 2.0 for all platforms
  • 17.
  • 18. Animation(I) File format: FBX 2016/2017 or later Axis conversion: Up axis is Y Scale factor: Centimeters Required geometry settings: Smoothing groups Smooth mesh Referenced asset content Recommended geometry settings: Tangents and binormals Triangulate NURBS Animation: enabled Deformed models settings: Deformed models Skins private void onPlayAnimation() { if (animator == null || !animator.isRunning()) { AnimationData data = andyRenderable.getAnimationData(nextAnimation); nextAnimation = (nextAnimation + 1) % andyRenderable.getAnimationDataCount(); animator = new ModelAnimator(data, andyRenderable); animator.start(); }
  • 19. Animation(II) private static ObjectAnimator createAnimator(boolean clockwise, float axisTiltDeg) { Quaternion[] orientations = new Quaternion[4]; //-------------------------------------------------------// ObjectAnimator orbitAnimation = new ObjectAnimator(); orbitAnimation.setObjectValues((Object[]) orientations); orbitAnimation.setPropertyName("localRotation"); //------------------------------------------------------/ return orbitAnimation; }
  • 21. ArCore + SceneformUX ● SceneView ● ArSceneView ● ArFragment ○ Check ARCore version ○ Check permissions ○ Session initialization and configuration ○ Handle gestures
  • 23. Image Recognition ● Up to 1000 reference images. ● Up to 20 images simultaneously in the environment, but it cannot track multiple instances of the same image. ● The physical image in the environment must be at least 15cm x 15cm and must be flat ● Once tracked, ARCore provides estimates for position, orientation, and physical size. These estimates are continuously refined as ARCore gathers more data. ● ARCore cannot track a moving image, but it can resume tracking that image after it stops moving. ● All tracking happens on the device, so no internet connection is required. Reference images can be updated on-device or over the network without requiring an app update.
  • 25. ViroCore SDK ● *Free ● Android API 21+ ● ReactNative ● AR ● VR ● Support glTF and *FBX animation ● PBR, Physics, Portals, Particle Effects, Views, e.t.c.
  • 26. Q&A
  • 27. Resources ● https://developers.google.com/ar/develop/java/sceneform/ ● https://proandroiddev.com/@harivigneshjayapalan ● https://github.com/google/filament ● https://google.github.io/filament/Filament.md.html ● https://developers.google.com/ar/ ● https://virocore.viromedia.com/