Cardboard VR: Building Low Cost VR Experiences

Post on 23-Jan-2017

5.382 views 2 download

Transcript of Cardboard VR: Building Low Cost VR Experiences

CARDBOARD VR: BUILDING LOW COST VR EXPERIENCES

Mark Billinghurst mark.billinghurst@unisa.edu.au

April 14th 2016 CHIuXiD

What You Will Learn • Virtual Reality Fundamentals + History • How to Build Cardboard VR Viewer • Example Cardboard VR Applications • Basics of Unity Programming • How to Make Panorama VR Applications • How to Create VR Scenes • How to Add Interactivity to VR Applications • Cardboard Design guidelines

VIRTUAL REALITY

Virtual Reality

Computer generated multi-sensory simulation of an artificial environment that is interactive and immersive.

David Zeltzer’s AIP Cube

! Autonomy – User can to react to events and stimuli.

! Interaction – User can interact with objects and environment.

! Presence – User feels immersed through sensory input and output channels

Interaction

Autonomy

Presence

VR

Zeltzer, D. (1992). Autonomy, interaction, and presence. Presence: Teleoperators & Virtual Environments, 1(1), 127-132.

Key Technologies • Autonomy

• Head tracking, body input •  Intelligent systems

•  Interaction • User input devices, HCI

• Presence • Graphics/audio/multisensory output • Multisensory displays

•  Visual, audio, haptic, olfactory, etc

Early Experimenters (1950’s – 80’s)

Helig 1956

Sutherland 1965

Furness 1970’s

The First Wave (1980’s – 90’s)

NASA 1989 VPL 1990’s

Virtuality 1990’s

Jaron Lanier

•  Founded VPL, coined term “Virtual Reality”

Desktop VR - 1995 • Expensive - $150,000+ •  2 million polys/sec • VGA HMD – 30 Hz • Magnetic tracking

Second Wave (2010 - ) • Palmer Luckey

• HMD hacker • Mixed Reality Lab (MxR)

• Oculus Rift (2011 - ) •  2012 - $2.4 million kickstarter •  2014 - $2B acquisition FaceBook •  $350 USD, 110o FOV

•  sddg

Oculus Rift

Sony Morpheus

HTC/Valve Vive

2016 - Rise of Consumer HMDs

Desktop VR 2016 • Graphics Desktop

•  $1,500 USD •  >4 Billion poly/sec

• $600 HMD •  1080x1200, 90Hz

• Optical tracking • Room scale

https://immersivelifeblog.files.wordpress.com/2015/04/vr_history.jpg

Market Size

Computer Based vs. Mobile VR

Mobile VR

CPU: 300 Mhz HDD; 9GB RAM: 512 mb Camera: VGA 30fps Graphics: 500K poly/sec

1998: SGI O2 2008: Nokia N95

CPU: 332 Mhz HDD; 8GB RAM: 128 mb Camera: VGA 30 fps Graphics: 2m poly/sec

Mobile Phone AR & VR • Mobile Phone AR

• Mobile phone • Live camera view • Senor input (GPS, compass)

• Mobile Phone VR • Mobile phone • Senor input (compass) • Additional VR viewer

VR2GO (2013)

• MxR Lab •  3D print VR viewer for mobiles • Open source hardware + software •  http://projects.ict.usc.edu/mxr/diy/vr2go/

Multiple Mobile VR Viewers Available

•  zxcvz

CARDBOARD VR

•  dsfsaf

Google Cardboard

• Released 2014 (Google 20% project) • >5 million shipped/given away • Easy to use developer tools

+ =

Cardboard ($2)

Lenses ($10)

Magnets ($6)

Velcro ($3)

Rubber Band (1¢)

Software

Components

Assembling the Cardboard Viewer

Version 1.0 vs Version 2.0

• Version 1.0 – Android focused, magnetic switch, small phone • Version 2.0 – Touch input, iOS/Android, fits many phones

Many Different Cardboard Viewers

SAMPLE CARDBOARD APPLICATIONS

Cardboard App • 7 default experiences

• Earth: Fly on Google Earth

•  Tour Guide: Visit sites with guides

• YouTube: Watch popular videos

• Exhibit: Examine cultural artifacts

• Photo Sphere: Immersive photos

• Street View: Drive along a street

• Windy Day: Interactive short story

100’s of Google Play Cardboard apps

Sample Applications

Cardboard Camera

• Capture 360 panoramas • Stitch together images on phone • View in VR on Cardboard

Google Expeditions

• Teacher led VR experiences • https://www.google.com/edu/expeditions/

Building Your Own Application • Cardboard Viewer

•  https://www.google.com/get/cardboard/

• Smart phone • Android/iOS

• Cardboard SDK •  iOS, Android, Unity •  https://developers.google.com/cardboard/

• Unity game engine (optional) •  https://unity3d.com

• Content

Cardboard SDK

Features:1.  Lensdistor-oncorrec-on.2.  Headtracking.3.  3Dcalibra-on.4.  Side-by-siderendering.5.  Stereogeometryconfigura-on.

6.  Userinputeventhandling.

Unity Cardboard SDK

INTRODUCTION TO UNITY

Unity 3D Game Editor

SETUP

Download and Install • Go to unity3d.com/download • Use Download Assistant – pick components you want

Getting Started •  First time running Unity you’ll be asked to create a project • Specify project name and location • Can pick asset packages (pre-made content)

Unity Interface •  Toolbar, Scene, Hierarchy, Project, Inspector

Customizable Interface

Building Scenes • Use GameObjects:

• Containers that hold different components •  Eg 3D model, texture, animation

• Use Inspector • View and edit object properties and other settings

• Use Scene View • Position objects, camera, lights, other GameObjects etc

• Scripting • Adding interaction, user input, events, etc

GameObjects • Every object in Scene is a GameObject • GameObjects contain Components

•  Eg Transform Component, Camera Component

Adding 3D Content

• Create 3D asset using modeling package, or download •  Fbx, Obj file format for 3D models

• Add file to Assets folder in Project • When project opened 3D model added to Project View • Drag mesh from Project View into Hierarchy or Scene View

•  Creates a game object

Positioning/Scaling Objects

• Click on object and choose transform

Unity Asset Store

• Download thousands models, scripts, animations, etc •  https://www.assetstore.unity3d.com/

UNITY BASICS

Making a Simple Scene 1.  Create New Project 2.  Create Game Object 3.  Moving main camera position 4.  Adding lights 5.  Adding more objects 6.  Adding physics 7.  Changing object materials 8.  Adding script behaviour

CreateProject

• Create new folder and project

New Empty Project

Create GameObject

•  Load a Sphere into the scene • GameObject -> 3D Object -> Sphere

Moving main camera

• Select Main Camera • Select translate icon • Move camera

Add Light

• GameObject -> Light -> Directional Light • Use inspector to modify light properties (colour, intensity)

Add Physics

•  Select Sphere •  Add Rigidbody component

•  Add Component -> Physics -> RigidBody •  or Component -> Physics -> RigidBody

•  Modify inspector properties (mass, drag, etc)

Add More Objects

• Add several cubes •  GameObject -> 3D Object – Cube

• Move cube • Add Rigid Body component (uncheck gravity)

Add Material

• Assets -> Create -> Material • Click Albedo colour box in inspector • Select colour • Drag asset onto object to apply

Add Script

• Assets -> Create -> C# script • Edit script using Mono • Drag script onto Game Object

Example C# Script GameObject Rotation

using UnityEngine; using System.Collections; public class spin : MonoBehaviour {     // Use this for initialization     void Start () {         }         // Update is called once per frame     void Update () {         this.gameObject.transform.Rotate(Vector3.up*10);     } } #

Scripting C# Unity 3D •  void Awake():

•  Is called when the first scene is loaded and the game object is active

•  void Start(): •  Called on first frame update

•  void FixedUpdate(): •  Called before physics calculations are made

•  void Update(): •  Called every frame before rendering

•  void LateUpdate(): •  Once per frame after update finished

Final Spinning Cube Scene

Resources • Unity Main site

• http://www.unity3d.com/ • Holistic Development with Unity

• http://holistic3d.com • Official Unity Tutorials

• http://unity3d.com/learn/tutorials • Unity Coder Blog

• http://unitycoder.com

IMMERSIVE PANORAMAS

Steps 1.  Create a new project 2.  Load the Cardboard SDK 3.  Load a panorama image asset 4.  Create a Skymap 5.  Add to VR scene 6.  Deploy to mobile phone

New Project

Load Cardboard SDK

• Assets -> Import Package -> Custom Package •  Navigate to CardboardSDKForUnity.unitypackage

• Uncheck iOS (for Android build)

Load Cardboard Main Camera

• Drag CardboardMain prefab into Hierarchy •  Assets -> Cardboard -> Prefab

• Delete CameraMain

Panorama Image Asset

•  Find/create suitable panorama image •  Ideally 2K or higher resolution image

• Google “Panorama Image Cubemap”

Add Image Asset to Project • Assets -> Import Asset

•  Select desired image

• Set Texture Type to Cubemap

• Set mapping to Latitude-Longitude (Cylindrical)

Create Skybox Material

• Assets -> Create -> Material • Name material • Set Shader to Skybox -> Cubemap • Drag texture to cubemap

Create Skybox • Window -> Lighting • Drag Skybox material into

Skypebox form

Panorama Image in Unity

One Last Thing..

• CardboardMain -> Head -> Main Camera • Set Clear Flags to Skybox

Test It Out

• Hit play, use alt/option key + mouse to look around

Deploy to Mobile (Android) 1.  Plug phone into USB

• make sure device in debug mode 2.  Set correct build settings 3.  Player settings

• Other settings • Set Bundle Idenitfier -> com.Company.ProductName

• Resolution and Presentation • Default Orientation -> Landscape Left

4.  Build and run

Deploying to Phone 1.  Plug phone into USB 2.  Open Build Settings 3.  Change Target platform to Android 4.  Resolution and Presentation

•  Default Orientation -> Landscape Left

5.  Under Player Settings •  Edit Bundle Identifier – eg com.UniSA.cubeTest •  Minimum API level

6.  Build and Run •  Select .apk file name

Running on Phone

• Droid@Screen View on Desktop

CREATING 3D ENVIRONMENTS

Key Steps 1.  Creating a new project 2.  Load Cardboard SDK 3.  Replace camera with CardboardMain 4.  Loading in 3D asset packages 5.  Loading a SkyDome 6.  Adding a plane floor

New Project

• Camera replaced with CameraMain

Download Model Package

• Magic Lamp from 3dFoin • Search on Asset store

Load Asset + Add to Scene

• Assets -> Import Package -> Custom Package •  Look for MagicLamp.unitypackage (If not installed already)

• Drag MagicLamp_LOD0 to Hierarchy • Position and rotate

Import SkySphere package

• SkySphere Volume1 on Asset store

Add SkySphere to Scene

• Drag Skyball_WithoutCap into Hierarchy •  SkySphere_V1 -> Meshes

• Rotate and Scale as needed

Add Ground Plane

• GameObject -> 3D Object -> Plane • Set Scale X to 2.0, Z to 2.0

Testing View

• Use alt/option key plus mouse to rotate view

Adding More Assets

•  Load from Asset store – look for free assets

ADDING INTERACTIVITY

Adding Movement Goal: Move in direction user looking when Cardboard Button pressed.

• Key Steps 1.  Start with static screen 2.  Create movement script 3.  Add movement script to Camera head 4.  Deploy to mobile

Static Scene

Create Movement Script • Add new script object

•  Assets -> Create -> C# Script

• Edit script in Mono

Add Script to Scene

• Drag Script onto Head object •  CameraboardMain -> Head

• Uncheck Track Position Box • Adjust movement speed

Adding More Interactivity

•  Load Cardboard Demo application •  Assets -> Import Package -> Custom Package •  Load CardboardDemoForUnity.unitypackage

•  Launch Demo Scene •  Assets -> Cardboard -> DemoScene

Features Shown

• Gaze reticle + selection • Viewpoint teleportation • Menu panel overlay • Audio feedback • Event system

DESIGN GUIDELINES

Google Design Guidelines

• Google’s Guidelines for good VR experiences: • Physiological Considerations •  Interactive Patterns

•  Setup •  Controls •  Feedback •  Display Reticle

•  From http://www.google.com/design/spec-vr/designing-for-google-cardboard/a-new-dimension.html

Physiological Considerations • Factors to Consider

• Head tracking • User control of movement • Use constant velocity • Grounding with fixed objects • Brightness changes

Interactive Patterns - Setup • Setup factors to consider:

• Entering and exiting • Headset adaptation • Full Screen mode • API calls •  Indicating VR apps

Interactive Patterns - Controls

• Use fuze buttons for selection in VR

Interactive Patterns - Feedback

• Use audio and haptic feedback • Reduce visual overload • Audio alerts •  3D spatial sound • Phone vibrations

Interactive Patterns - Display Reticle

• Easier for users to target objects with a display reticle • Can display reticle only when near target object • Highlight objects (e.g. with light source) that user can target

Cardboard Design Lab Application

• Use Cardboard Design Lab app to explore design ideas

CONCLUSION

Conclusion • Virtual Reality industry starting to boom again • Google Cardboard provides a great entry for VR

• Consumer hardware • Cheap/free viewer •  Industry standard game engine • High quality content • Many tutorials/learning resources

• The time to get started is now!

RESOURCES

Useful Resources • Google Cardboard main page

•  https://www.google.com/get/cardboard/

• Developer Website •  https://www.google.com/get/cardboard/developers/

• Building a VR app for Cardboard •  http://www.sitepoint.com/building-a-google-cardboard-vr-app-in-unity/

• Creating VR game for Cardboard •  http://danielborowski.com/posts/create-a-virtual-reality-game-for-

google-cardboard/

• Moving in VR space •  http://www.instructables.com/id/Prototyping-Interactive-Environments-

in-Virtual-Re/

www.empathiccomputing.org

@marknb00

mark.billinghurst@unisa.edu.au