68
Creating Augmented Reality Experience with Layar Xuan Wang Developer Support, Layar

Layar, the next mass medium

Embed Size (px)

DESCRIPTION

Xuan Wang from Layar's developer support team explains how Layar works and how to start making your own layers.

Citation preview

Page 1: Layar, the next mass medium

Creating Augmented Reality Experience with Layar Xuan WangDeveloper Support, Layar

Page 2: Layar, the next mass medium

Content• General Intro:

• What is Layar ?

• What does it offer ?

• How to create a layer ?

• Q&A, Discussion

• 3D modeling in Layar:

• What’s possible now?

• What are the best practices ?

• How to get 3d models in a layer ?

• Q&A, Discussion

Page 3: Layar, the next mass medium
Page 4: Layar, the next mass medium

GPSWhere am I?

CameraWhat do I see in the real world?

Compass In which direction am I looking?

AccelerometerHow is my phone oriented in the world?

Internet connectivityTo connect to the digital world

Gyroscope (optional)To provide a smoother experience

Page 5: Layar, the next mass medium

Information Service

Page 6: Layar, the next mass medium

Earthquake information

Page 7: Layar, the next mass medium

Experience - Berlin wall

Page 8: Layar, the next mass medium

WTC

Page 9: Layar, the next mass medium

Future - UAR

Page 10: Layar, the next mass medium

Brands/Agents: Audi A1, Moscow

Page 11: Layar, the next mass medium

Events

Page 12: Layar, the next mass medium

Social Service -Tweets Around

Page 13: Layar, the next mass medium

Foursquare

Page 14: Layar, the next mass medium

Games - ScavengAR Hunt

Page 15: Layar, the next mass medium

Uninvited Art Exhibition, MoMA

Page 16: Layar, the next mass medium

Layer Features Overview

• Support for icon/images/3D models

• Support for animated POIs

• Sharing to facebook, Twitter and Developer’s server

• Actions: call, email, share, web page, audio, video, etc

• Gaming elements: autotriggers, relative POIs, point to point

Page 17: Layar, the next mass medium

Open Platform

Page 18: Layar, the next mass medium

Brands, publishers Developers Layar End userContent Layers

Distribution

Search & Discovery

The Layar ecosystem

Page 19: Layar, the next mass medium

Layar Platform Components

Browser Player Publishing

Page 20: Layar, the next mass medium

Layar Connect - Layer Management System

• Publishing API for Third party layer management system

• End-to-end and one-stop-shop

Page 21: Layar, the next mass medium

Layar Platform Architecture

Layar server

Fixeddata

Layar publishing

environment

Layer service provider

Layer content sources

Get layersGet POIs

Layer definitio

ns

Layer Developer API

Get POIs

Create layer

Get POIsView POI information

View POI information

GPS data

Layar environment

Third-party environment

Legend

Page 22: Layar, the next mass medium

How to create layers ?

• Layers can be built using simple web technology

• You can use programming languages like PHP, MySQL, Java etc as long as the response is in JSON format

• 2 step process:

1. Create a layer definition in the Layar publishing environment (or using layar connect calls)

2. Create a layer service for delivering the POI content to the Layar app (Based on Developer API )

Page 23: Layar, the next mass medium

Step 1: Publishing environment

• http://layar.com/publishing

• Add all the static content and metadata of a layer

• Listing details

• Look & feel

• Service provider URL (connect to your web service)

Page 24: Layar, the next mass medium

Step 2: Layer service

• Create a layer service for delivering the POI content to the Layar app

• The following elements are needed to set up a layer service:

• A public web server

• A database

• The response should be in JSON format

Page 25: Layar, the next mass medium

Third party tools

• Instead of creating your own layer service, you can use one of the third party tools developed by the community, e.g.:

• PorpoiseOpen source server software, requires programming skills, more control

• Hoppala AugmentationHosted solution, easy to use, limited funtionality

• LMS using Layar Connect, such as BuildAR, Poistr, Poiz, VISAR, etc.

Page 26: Layar, the next mass medium

Developer Support

• The following support resources provide a wealth of information for developers:

• Layar developer wiki

• Layar developer support environment

• Discussion forums

• Support tickets

Page 27: Layar, the next mass medium

Launched in June 2009

Based in Amsterdam

VC funded

55 people

About Layar

Page 28: Layar, the next mass medium

3D modeling in Layar

• 3D capability in Layar

• Creating 3d models

• Converting 3D model (Layar3D Model Converter)

• Rendering 3d models

Page 29: Layar, the next mass medium

Layar Augmented Office

Page 30: Layar, the next mass medium

• Multiple materials with coloring and shininess

• Static/Animated texture

• Texture transparency

• Build 3D model on the fly

• Animation API (apply animation programmatically)

What’s possible now ?

Page 31: Layar, the next mass medium

General Flow

3D modeling Software, Blender, Google

Sketchup, 3ds Max, etc

wavefront file format(.obj/.mtl)

Layar3D Model Converter

.L3D file format

save as input output

Page 32: Layar, the next mass medium

• Coordinate system:

X → West to East

Y → South to North

Z → Ground to Sky

• Vertex: point in 3D space

• Face/polygons: area connecting 3 or more vertices.

Creating 3D models - Terminology (1)

Page 33: Layar, the next mass medium

• Normals:

• Indicate the direction of a face.

• Only front facing faces are rendered.

• have effect on the light shading

• If not present in your model, the vertex order is important. (front face is counter clock wise)

Creating 3D models - Terminology (2)

Page 34: Layar, the next mass medium

• Materials:

• Diffuse color: The main color of the material that is used when light is reflected on it.

• Ambient color: The color of the material that is used for environment light.

• Specular color: The color of the highlight in the model (often white)

• Shininess: controls the size of the highlight. High shininess gives a small highlight, low shininess makes the highlight area larger.

Creating 3D models - Terminology (3)

Page 35: Layar, the next mass medium

Limitations - Mobile devices

• Limited bandwidth (phone operator) - takes too long to load large files.

• Limited Memory/ processing power (low-end devices)

• The screen is small (usually 800X480), subtle details can not be seen.

• Limited GPU (Graphics processor) power

Page 36: Layar, the next mass medium

Limitations - Mobile devices

Keep the balance between complexity and efficiency !

• Limited bandwidth (phone operator) - takes too long to load large files.

• Limited Memory/ processing power (low-end devices)

• The screen is small (usually 800X480), subtle details can not be seen.

• Limited GPU (Graphics processor) power

Page 37: Layar, the next mass medium

• Polygon counts: recommended max. 10000 (after triangulation)

• File size: max 1mb

• Only support mesh based objects (polygonal modeling)

• The unit for the vertex coordinates is set to 1 meter.

• Keep the object centered on the grid (recommended)

• No transparency on the normal material colors (no alpha blending)

3D Model Requirements

Page 38: Layar, the next mass medium

• Supported Texture formats: PNG, JPEG, GIF (static/animated)

• Resized to be nearest power of 2 (width & height), 16x16, 32x64, etc.

• Use UV mapping

• Texture transparency is supported (PNG only)

• No blending (partial transparency not supported)

• No multiple textures supported for one material, e.g. bump mapping.

Texture Requirements

Page 39: Layar, the next mass medium

Texture UV Mapping

Page 40: Layar, the next mass medium

• Alpha values <0.1 are not rendered at all, causing the models behind the face to show. (cutout effect)

• Semi transparent color values (0.1 <alpha<1.0) are blended with the camera image, the models behind it are not shown.

Texture Transparency (1)

Page 41: Layar, the next mass medium

Texture Transparency (2)

Page 42: Layar, the next mass medium

Animated Texture

• Add frames:

• Using animated GIF texture, or,

• Add frames in Layar3D model converter

• Use good compression in image files (PNG, reduce number of colors)

• Use small images (recommended smaller than 256x256)

• Recommend to limit the number of frames to 10

Page 43: Layar, the next mass medium

Animated Texture

• Add frames:

• Using animated GIF texture, or,

• Add frames in Layar3D model converter

• Use good compression in image files (PNG, reduce number of colors)

• Use small images (recommended smaller than 256x256)

• Recommend to limit the number of frames to 10

Keep the balance between texture size and file size!

Page 44: Layar, the next mass medium

• Start with the basic model and add details later

• Keep the model complexity as low as possible

• use texture to add details, such as windows, doors, etc.

• prepare a simple version of the model ( 2 level of details supported in Layar )

• Keep the model as clean as possible

• no floating vertex points

• no overlapping faces/polygons

• remove invisible faces/polygons

• Check if the normals are facing out.

Guidelines & Best Practices - Model

Page 45: Layar, the next mass medium

• Keep the texture images as small as possible

• Use good compression in image files

• Reduce the amount of images used and combine them into a single texture file (UV-mapping).

• Create “see-through” parts using texture transparency.

• Optimize material group and organize faces based on material.

Guidelines & Best Practices - Textures

Page 46: Layar, the next mass medium

• Keep the texture images as small as possible

• Use good compression in image files

• Reduce the amount of images used and combine them into a single texture file (UV-mapping).

• Create “see-through” parts using texture transparency.

• Optimize material group and organize faces based on material.

Guidelines & Best Practices - Textures

Make sure your model is ready before export to .obj file!

Page 47: Layar, the next mass medium

• Convert Wavefront format to Layar3D (.l3d) format, which is based on Wavefront (.obj) but optimized for mobile phone devices.

• written in Java, requires Java v6.0

• Command line version is available

Layar 3D Model Converter

Page 48: Layar, the next mass medium

• Imported files

• .obj - contains the vertex and face data

• .mtl - contains the materials and references to texture files

• .png/.jpg/.gif - texture images

• Open existing .l3d model

Layar 3D Model Converter - Importing

Page 49: Layar, the next mass medium

Layar 3D Model Converter -Overview

• Model details

• Model dimensions (in meters)

• File size (bytes)

Page 50: Layar, the next mass medium

Layar 3D Model Converter -Materials

• Review materials and textures

• Edit colors and shininess values

• Replace texture

Page 51: Layar, the next mass medium

Layar 3D Model Converter - Animated Texture

• Change texture type:

• no texture

• static

• animated

• Add animated frames

Page 52: Layar, the next mass medium

Layar 3D Model Converter - Preview

• Imitating the Layar reality browser behavior in terms of 3D rendering

• The same look and feel can be expected in Layar reality Browser (v5.0 and above)

Page 53: Layar, the next mass medium

Layar 3D Model Converter - Edit model

• Basic functions for quick fix

• Will take effect after saving the model to .l3d format

• Still recommend to correct these while preparing the model in the modeling software

Page 54: Layar, the next mass medium

Layar 3D Model Converter - Placement

• Place the 3D model directly on the map ( bird view )

• Help find the accurate position of the model

• Save placement details in JSON format

Page 55: Layar, the next mass medium

Layar 3D Model Converter - Saving

• Save as .l3d model

• .l3d file embeds all textures and materials

Page 56: Layar, the next mass medium

• Approach 1:

• Create .obj file based on .obj file format

• Convert to .l3d model using command line version of Layar3D model converter.

• Approach 2:

• Generate .l3d file directly (in binary format, file format is available upon request)

Creating 3d model on the fly

Page 57: Layar, the next mass medium

• OpenGL ES API

• Simulated camera view in OpenGL

• position

• view

• up

• Object is rendered with perspective

Rendering 3D models in Layar

Page 58: Layar, the next mass medium

• Given: a 3d cube which is 500m away from user’s position and it is 50m in width, 40m in length and 30m in height.

• Question: How is it rendered in Layar ?

Rendering 3D models in Layar

Page 59: Layar, the next mass medium

{

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Define 3d Parameters in JSON Response

• 2 levels of detail for the 3d model : full, reduced

• “size” : determines which model to pick up to render. The length of the edge of the smallest cube in which the object can fit.

• “angle”: rotates the object around the z-axis (right hand rule)

• “rel”: if true, the rotation is calculated relative to the position of the user.

• “scale”: can be applied to alter the model size.

Page 60: Layar, the next mass medium

Which model to pick up ? (1)

• The rendered size in Layar is determined by:

• Distance: between the 3d model and the user, e.g. 500m

• “size”: the size parameter in “object”

• Scale factor: the “scale” parameter in “transform”.

{

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Page 61: Layar, the next mass medium

Which model to pick up ? (1)

In Layar, in the distance of 500m, there is a 3d object which is 100m (50m x 2) in width, length and height.

• The rendered size in Layar is determined by:

• Distance: between the 3d model and the user, e.g. 500m

• “size”: the size parameter in “object”

• Scale factor: the “scale” parameter in “transform”.

{

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Page 62: Layar, the next mass medium

• rendered size > 100 px, “full” model is picked up.

• 20 px < rendered size <100 px, “reduced” model is picked up.

• rendered size < 20 px, “icon” image is used and scaled down to 10 px threshold.

Which model to pick up ? (2){

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Page 63: Layar, the next mass medium

Based on the rendered size, layar client will determine which model (full/reduced/icon) should be downloaded and rendered.

• rendered size > 100 px, “full” model is picked up.

• 20 px < rendered size <100 px, “reduced” model is picked up.

• rendered size < 20 px, “icon” image is used and scaled down to 10 px threshold.

Which model to pick up ? (2){

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Page 64: Layar, the next mass medium

In Layar, in the distance of 500m, there is a 3d object which is 100m (50m x 2) in width, 80m in length and 60m height.

• The real size embedded in the 3d model will be used, instead of the “size” parameter.

• The “scale” factor will be applied to the real size of the model

The Actual Rendering{

"dimension": 3,

"object": {

"baseURL": “http://layar.example.com/”,

“full”: “full.l3d”,

“reduced”: “reduced.l3d”,

“icon”: “icon.png”,

“size”: 50

}

“transform”: {

“angle”: 45,

“rel”: false,

“scale”: 2

}

Page 65: Layar, the next mass medium

Animation API

• A collection of pre-defined animations on POIs.

• Simple appearance animation (drop, grow, spin)

• Full customizable animation: onClick, onUpdate, onFocus, etc

• Layer level/POI level

Animation Video

Page 66: Layar, the next mass medium

Useful links

• Creating 3D models (http://layar.pbworks.com/w/page/7783224/Creating-the-3D-objects)

• Download Layar3D model converter (http://public.layar.com/downloads/Layar3DModelConverter.jnlp) 

• Using Layar3D model converter (http://layar.pbworks.com/w/page/32586555/3D-Model-Converter)

• Animation API (http://layar.pbworks.com/w/page/35910564/animation-for-API-5)

• Need Help ? Devsupport environment (http://devsupport.layar.com)

Page 67: Layar, the next mass medium

Discussion

Page 68: Layar, the next mass medium

Thank [email protected]