cpsc 599/601 easyar and assignment 1using unity3d and easyar (or another ar tool if you prefer),...

51
CPSC 599/601 EasyAR and Assignment 1 Slides by Jessi Stark

Upload: others

Post on 20-Mar-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

CPSC 599/601EasyAR and Assignment 1

Slides byJessi Stark

Page 2: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

In case you forgot...

Jessi Stark

• Slack: Jessi

• Email: [email protected]

• Slides: jtstark.com/teaching

Page 3: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Today’s Agenda

• Video vs. optical AR devices

• Set up EasyAR accounts

• EasyAR demo• Build and run a sample program to see how it works

• EasyAR basics

• Trigger events

• Assignment 1 overview

Page 4: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Video see-through vs.optical see-through.

Page 5: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Types of AR devices

Video see-through Optical see-through

Page 6: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Types of AR devices

Video see-through Optical see-through

• Video + graphics combined into image

• Occlusion

• Mobile: very limited field of view

• HMD: decent field of view

• Graphics projected onto see-through surface

• No occlusion

• Limited field of view

Page 7: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Types of AR devices

Video see-through Optical see-through

• Video + graphics combined into image

• Occlusion

• Mobile: very limited field of view

• HMD: decent field of view

• Graphics projected onto see-through surface

• No occlusion

• Limited field of view

Page 8: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

EasyAR.

Page 9: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

EasyAR

• Makes AR development easy (mostly)

• Every project needs a licence key

• Luckily, keys are free when you make a free account

• Go here: https://www.easyar.com/

Page 10: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 11: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 12: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

EasyAR SDK

• The EasyAR SDK should already be installed on the computers in this room (MS156)

• To install it on your own machine, get it from here:• https://www.easyar.com/view/download.html#download-nav2

• EasyAR SDK 2.3.0 Basic for Unity3D (unitypackage)

Page 13: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

EasyAR demo.

Page 14: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Download and run sample EasyAR program

• Download sample .zip file• https://www.easyar.com/view/download.html#download-nav2

• Unzip

• Open HelloARMultiTarget-MultiTracker project in Unity

• Create a licence key

• Change build settings for Android deployment

• Change player settings for Android deployment

• Build and run!

Page 15: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 16: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 17: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 18: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 19: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 20: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 21: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 22: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 23: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 24: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 25: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 26: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Connect your Android device via USB and then…

Page 27: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 28: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Voila!

• You should now have a working AR demo app running on your device.

• It will stay there. You don’t need to re-deploy unless you make changes.

• This multi-tracker demo can track multiple image targetssimultaneously! :o

• To test it out, grab the image files from Assets -> StreamingAssetsinside the project folder.

Page 29: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Whoa! More samples!

• Check out the rest to see how they do similar things with QR codes, identical targets, video content, etc.

Page 30: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

EasyAR basics.

Page 31: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Let’s make our own AR app.

• Import the EasyAR package

• Add an EasyAR prefab to the scene

• Make the background transparent

• Create ImageTrackers

• Create ImageTargets

• Attach objects to targets

Page 32: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 33: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Find the EasyAR Unity package

• On the lab computers, your package file should be here:• C:\CourseWare\EasyAR_SDK_2.3.0

• On your own machines, it will be wherever you put it (naturally).

Page 34: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 35: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Add an EasyAR prefab to the scene

• Drag “EasyAR_startup” into the scene.• There are other prefabs you can use in the “Composites” folder.

• The EasyAR prefabs contain a camera object, so remove the defaultMainCamera.

• Under RenderCamera:• Clear Flags: Solid Color

• Background: Black

• Under ARCamera:• World Center: First Target

• You can use other settings depending on your project

Page 36: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 37: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 38: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

ImageTrackers

• To track multiple images, we should use multiple image trackers.• This will allow us to always keep track of multiple targets simultaneously.

• One tracker can detect multiple images simultaneously by changing theSimultaneous Target property, provided they are all in view. However, it will only track one image at a time.

• Assign a tracker to each image target

Page 39: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 40: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

ImageTargets

• Images should be high contrast with a complex pattern in order to be easily recognized.

• We can turn images into materials by importing them into the project and dragging them onto the ImageTarget object.

• We will need to add a script that defines the behaviour the ImageTarget should have when it is loaded onto the ImageTracker.• http://jtstark.com/teaching/

• The ImageTarget needs to hold a reference to the appropriate ImageTracker.

Page 41: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 42: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 43: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 44: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Put 3D objects in the “real” world

• To attach 3D content to images in the real world, we simply need to add that object as a child of the target.

Page 45: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset
Page 46: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Ready to deploy!

• Set the player settings

• Set the build settings

• Plug in your device

• Build and Run

Page 47: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Time to catch our breath.Phew. That was a lot.

Page 48: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Assignment 1

Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application.

• Download a character from the Asset Store. (Or, if you’re feeling ambitious, try creating your own!)

• Recognize elements of the physical environment in your application (this can be either image targets or the environment itself).

• Program your character to move between at least three points in the scene.

• Trigger an exciting event when the character reaches its final point!

Page 49: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

A1 Skills

• By now, we should have most of the skills to complete assignment 1.• We know about the Asset Store (last week).

• We know how to recognize image targets.

• We know how to attach objects to the image targets.

• We know how to make some objects move (last week).

• Animations will help us move characters in a nicer way.

• Remember: the IsTrigger property of an object’s collider component will allow us to invoke our own scripts on the object.

Page 50: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Useful Links

• Unity tutorials: https://unity3d.com/learn/tutorials

• Unity API: https://docs.unity3d.com/ScriptReference/index.html

• Microsoft APIs: https://docs.microsoft.com/en-us/dotnet/api/

• EasyAR tips: https://www.easyar.com/doc_sdk/en/Getting-Started/Setting-up-EasyAR-Unity-SDK.html

Page 51: CPSC 599/601 EasyAR and Assignment 1Using Unity3D and EasyAR (or another AR tool if you prefer), create a simple augmented reality application. •Download a character from the Asset

Next time on CPSC Mixed Realities...Simple animations. Triggers. A1 partial walkthrough.