introduction to ar with unity3d

39
AR with Unity3D Introduction to Augmented Reality with Unity3D Saturday, May 26, 12

Upload: andreas-blick

Post on 31-Aug-2014

30.804 views

Category:

Technology


8 download

DESCRIPTION

Introduction to Augmented Reality with Unity3D, Vuforia & String Example implementations (iOS): Other Side - Pantalla Global: http://itunes.apple.com/app/other-side/id495565861

TRANSCRIPT

Page 1: Introduction to AR with Unity3D

AR with Unity3DIntroduction to Augmented Reality

withUnity3D

Saturday, May 26, 12

Page 2: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Intro

• Examples

• Pantalla Global (CCCB)

• Animac

• Salón de Turisme

Saturday, May 26, 12

Page 3: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Koffa@Animac

http://vimeo.com/37868229

Saturday, May 26, 12

Page 4: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

What is AR?

• Virtual content overlayed onto the real word

• 2D / 3D & audio

• Realtime / Live camera view

Saturday, May 26, 12

Page 5: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Detection

• Vision based

• QR codes

• Markers

• Real life objects

• Location based (GPS, Compass)

Saturday, May 26, 12

Page 6: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Vision Based AR

• Tracking

• Frame by frame analysis searching for “trackables”

• Return position and orientation relative to device

Saturday, May 26, 12

Page 7: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

AR Apps

• Layar

• http://www.layar.com/

• Junaio

• http://www.junaio.com/

• Wikitude

• http://www.wikitude.com/

• Appunta ;-)

• http://appunta.com/

Saturday, May 26, 12

Page 8: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Use

• Arts & Gaming

• Advertising

• Navigation

• Tourism

• Education

• ... and a lot more

Saturday, May 26, 12

Page 10: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

String - Tracking

• Framed Markers

• Multiple marker detection

• <= 10

• Unflexible marker creation

• black border surrounded by a white border necessary

Saturday, May 26, 12

Page 11: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

String - Tracking

• Any png

• Full marker has to be in camera (>85%)

• Markers not in scene

• dificult scaling

Saturday, May 26, 12

Page 12: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Vuforia - Tracking

• Image Target

• Frame Markers

• Simple 3D Objects (Boxes)

• More flexible than String on marker creation

Saturday, May 26, 12

Page 13: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Vuforia - Tracking

• Multiple Image Targets or Frame Markers

• <= 5

• Works if only part of the marker is seen

• Markers placed into 3D Scene

• easy scaling

• Virtual Buttons

Saturday, May 26, 12

Page 14: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Target Management

• Online

• ImageTargets

• MultiTargets

• jpg & png

• RGB & B&W

• Scaling (Unity units)

Rich in detail

High in contrast

No repetitive patterns!

Saturday, May 26, 12

Page 15: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Performance

• String a little bit faster in detection and tracking

• String is more stable

Saturday, May 26, 12

Page 16: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Platform support

• Vuforia

• Android & iOS

• String

• iOS

Saturday, May 26, 12

Page 17: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

String - Setup

• Download library

• Unity3d

• iOS

• Add to Unity3D project

• Add to XCode project

Saturday, May 26, 12

Page 18: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Vuforia - Setup

• Download Vuforia library

• available in Assets Store

• Add to Unity3D Project

Saturday, May 26, 12

Page 19: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Testing

• String:

• In-Editor testing using webcam

• Vuforia:

• No image tracking nor life camera

• Device Only Testing

Unity Remote!

Saturday, May 26, 12

Page 20: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Licensing

• Unity / Unity iOS / Unity Android

• https://store.unity3d.com/

• String

• Expensive!

• http://www.poweredbystring.com/licensing

• Vuforia

• Free!!!

Saturday, May 26, 12

Page 21: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Decision ???

Saturday, May 26, 12

Page 22: Introduction to AR with Unity3D

Vuforia

Saturday, May 26, 12

Page 23: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Requirements iOS

• Mac OS Snow Leopard & Lion

• XCode

• https://ar.qualcomm.at/qdevnet/sdk/ios

Saturday, May 26, 12

Page 24: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Requirements Android

• MS Windows 7 & XP

• Linux & Mac OS posssible but not documented

• JDK + Eclipse + ADT

• Android SDK + NDK

• https://ar.qualcomm.at/qdevnet/sdk/android

Saturday, May 26, 12

Page 25: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Installation

• Download pagackage vuforia-unity-OS-Version.zip and install

• base extension & samples

• Asset Store

Saturday, May 26, 12

Page 26: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Simple Project• New project

• Add Vuforia

• Add Dataset (markers)

• Add ARCamera Prefab to scene

• Add ImageTarget Prefab to scene

• Select Dataset and ImageTarget

• Add 3D objects + Light

• Set Load Dataset

• Deploy

Saturday, May 26, 12

Page 27: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Unity Folder Structure

Saturday, May 26, 12

Page 28: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Hands-On

• DroidBalls

• Floating spheres in space

• Touch to dissappear

Saturday, May 26, 12

Page 29: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Raycasting

• Detect 3D object touched on screen

• Ray from touched screen point to camera

• Detect object collisions

Saturday, May 26, 12

Page 30: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Tracking

• ITrackableEventHandler

• OnTrackableStateChanged

• DefaultTrackableEventHandler

• enable/disable rendering

• ITrackerEventHandler

• OnTrackablesUpdated

Saturday, May 26, 12

Page 31: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Splash Screen

• Display when no marker is detected

• Modify ITrackableEventHandler

Saturday, May 26, 12

Page 32: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Virtual Buttons

• Hotspots on an ImageTarget

• IVirtualButtonEventHandler

• OnVirtualButtonPressed

• OnVirtualButtonReleased

• Can be created at runtime

Saturday, May 26, 12

Page 33: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Problems

• Perfomance

• Image Recognition

• symmetry / similar elements

• contrast / illumination

• Real world sizing

Saturday, May 26, 12

Page 34: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Problems

• Fixed camera vs fixed space

• Physics!!!

• Multiple markers

• center???

Saturday, May 26, 12

Page 35: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Tips & Advices

• 3D Models

• < 2K polygons overall

• < 200 polygons/object (draw calls)

• <= 3 materials/object

• Animations

• < 30 bones

• Use texture sequences

Device dependent!

Saturday, May 26, 12

Page 36: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Tips & Advices

• Attach markers to cardboard

• Good lightning but avoid reflections

• Disable objects that are not in view

• Test using mouse instead of touch

Saturday, May 26, 12

Page 37: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Tips & Advices

• Scale correctly from the beginning

• Create simple reference objects to map to real world

• e.g. cubes

Saturday, May 26, 12

Page 38: Introduction to AR with Unity3D

26/05/2012 - CatDroid Unity3D II @aquarioverdeAR with Unity3D

Resources

• Unity3D

• http://forum.unity3d.com

• http://answers.unity3d.com

• Vuforia Forums

• https://ar.qualcomm.at/qdevnet/forums

• String ???

Saturday, May 26, 12

Page 39: Introduction to AR with Unity3D

Thank you!Andreas Blick @aquarioverde

Saturday, May 26, 12