Augmented Reality for Developers

Book description

Build exciting AR applications on mobile and wearable devices with Unity 3D, Vuforia, ARToolKit, Microsoft Mixed Reality HoloLens, Apple ARKit, and Google ARCore

About This Book

  • Create unique AR applications from scratch, from beginning to end, with step-by-step tutorials
  • Use Unity 3D to efficiently create AR apps for Android, iOS, and Windows platforms
  • Use Vuforia, ARTookKit, Windows Mixed Reality, and Apple ARKit to build AR projects for a variety of markets
  • Learn best practices in AR user experience, software design patterns, and 3D graphics

Who This Book Is For

The ideal target audience for this book is developers who have some experience in mobile development, either Android or iOS. Some broad web development experience would also be beneficial.

What You Will Learn

  • Build Augmented Reality applications through a step-by-step, tutorial-style project approach
  • Use the Unity 3D game engine with the Vuforia AR platform, open source ARToolKit, Microsoft's Mixed Reality Toolkit, Apple ARKit, and Google ARCore, via the C# programming language
  • Implement practical demo applications of AR including education, games, business marketing, and industrial training
  • Employ a variety of AR recognition modes, including target images, markers, objects, and spatial mapping
  • Target a variety of AR devices including phones, tablets, and wearable smartglasses, for Android, iOS, and Windows HoloLens
  • Develop expertise with Unity 3D graphics, UIs, physics, and event systems
  • Explore and utilize AR best practices and software design patterns

In Detail

Augmented Reality brings with it a set of challenges that are unseen and unheard of for traditional web and mobile developers. This book is your gateway to Augmented Reality development - not a theoretical showpiece for your bookshelf, but a handbook you will keep by your desk while coding and architecting your first AR app and for years to come.

The book opens with an introduction to Augmented Reality, including markets, technologies, and development tools. You will begin by setting up your development machine for Android, iOS, and Windows development, learning the basics of using Unity and the Vuforia AR platform as well as the open source ARToolKit and Microsoft Mixed Reality Toolkit. You will also receive an introduction to Apple's ARKit and Google's ARCore! You will then focus on building AR applications, exploring a variety of recognition targeting methods. You will go through multiple complete projects illustrating key market sectors including business marketing, education, industrial training, and gaming.

By the end of the book, you will have gained the necessary knowledge to make quality content appropriate for a range of AR devices, platforms, and intended uses.

Style and approach

This book adopts a practical, step-by-step, tutorial-style approach. The design principles and methodology will be explained by creating different modules of the AR app.

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Downloading the color images of this book
      3. Errata
      4. Piracy
      5. Questions
  2. Augment Your World
    1. What is augmented reality?
    2. Augmented reality versus virtual reality
    3. How AR works
      1. Handheld mobile AR
      2. Optical eyewear AR
      3. Target-based AR
      4. 3D spatial mapping
      5. Developing AR with spatial mapping
      6. Input for wearable AR
      7. Other AR display techniques
    4. Types of AR targets
      1. Marker
      2. Coded Markers
      3. Images
      4. Multi-targets
      5. Text recognition
      6. Simple shapes
      7. Object recognition
      8. Spatial maps
      9. Geolocation
    5. Technical issues in relation to augmented reality
      1. Field of view
      2. Visual perception
      3. Focus
      4. Resolution and refresh rate
      5. Ergonomics
    6. Applications of augmented reality
      1. Business marketing
      2. Education
      3. Industrial training
      4. Retail
      5. Gaming
      6. Others
    7. The focus of this book
    8. Summary
  3. Setting Up Your System
    1. Installing Unity
      1. Requirements
      2. Download and install
    2. Introduction to Unity
      1. Exploring the Unity Editor
      2. Objects and hierarchy
      3. Scene editing
        1. Adding a cube
        2. Adding a plane
        3. Adding a material
        4. Saving the scene
        5. Changing the Scene view
      4. Game development
        1. Material textures, lighting, and shaders
        2. Animation
        3. Physics
        4. Additional features
    3. Using Cameras in AR
    4. Getting and using Vuforia
      1. Installing Vuforia
        1. Downloading the Vuforia Unity package
        2. Importing the Vuforia Assets package
      2. VuforiaConfiguration setup
        1. License key
        2. Webcam
      3. Building a quick demo with Vuforia
        1. Adding AR Camera prefab to the Scene
        2. Adding a target image
        3. Adding a cube
    5. Getting and using ARToolkit
      1. Installing ARToolkit
      2. Importing the ARToolkit Assets package
      3. ARToolkit Scene setup
        1. Adding the AR Controller
        2. Adding the AR Root origin
        3. Adding an AR camera
        4. Saving the Scene
      4. Building a quick demo with ARToolkit
        1. Identifying the AR Marker
        2. Adding an AR Tracked Object
        3. Adding a cube
    6. Summary
  4. Building Your App
    1. Identifying your platform and toolkits
    2. Building and running from Unity
    3. Targeting Android
      1. Installing Java Development Kit (JDK)
        1. About your JDK location
      2. Installing an Android SDK
        1. Installing via Android Studio
        2. Installing via command-line tools
        3. About your Android SDK root path location
      3. Installing USB device, debugging and connection
      4. Configuring Unity's external tools
      5. Configuring a Unity platform and player for Android
      6. Building and running
      7. Troubleshooting
        1. Android SDK path error
        2. Plugins colliding error
      8. Using Google ARCore for Unity
    4. Targeting iOS
      1. Having an Apple ID
      2. Installing Xcode
      3. Configuring the Unity player settings for iOS
      4. ARToolkit player settings
      5. Building and running
      6. Troubleshooting
        1. Plugins colliding error
        2. Recommended project settings warning
        3. Requires development team error
        4. Linker failed error
        5. No video feed on the iOS device
      7. Using Apple ARKit for Unity
    5. Targeting Microsoft HoloLens
      1. Having a Microsoft developer account
      2. Enabling Windows 10 Hyper-V
      3. Installing Visual Studio
      4. Installing the HoloLens emulator
      5. Setting up and pairing the HoloLens device for development
      6. Configuring Unity's external tools
      7. Configuring the Unity platform and player for the UWP holographic
        1. Build settings
        2. Quality settings
        3. Player settings - capabilities
        4. Player settings - other settings
      8. Vuforia settings for HoloLens
        1. Enabling extended tracking
        2. Adding HoloLensCamera to the Scene
        3. Binding the HoloLens Camera
      9. Building and running
      10. Holographic emulation within Unity
      11. MixedRealityToolkit for Unity
    6. Summary
  5. Augmented Business Cards
    1. Planning your AR development
      1. Project objective
      2. AR targets
      3. Graphic assets
        1. Obtaining 3D models
        2. Simplifying high poly models
      4. Target device and development tools
    2. Setting up the project (Vuforia)
    3. Adding the image target
      1. Adding ImageTarget prefab to the scene
      2. Creating the target database
      3. Importing database into Unity
      4. Activating and running
      5. Enable extended tracking or not?
    4. What makes a good image target?
    5. Adding objects
    6. Building and running
    7. Understanding scale
      1. Real-life scale
      2. Virtual scale and Unity
      3. Target scale and object scale
    8. Animating the drone
      1. How do the blades spin?
      2. Adding an Idle animation
      3. Adding a fly animation
      4. Connecting the clips in the Animator Controller
      5. Playing, building and running
    9. Building for iOS devices
      1. Setting up the project
      2. Adding the image target
      3. Adding objects
      4. Build settings
      5. Building and running
      6. Building and running using Apple ARKit
    10. Building for HoloLens
      1. Setting up the project
      2. Adding the image target
      3. Adding objects
      4. Build settings
      5. Building and running
    11. Building with ARToolkit
      1. Setting up the project
      2. Preparing the image target
      3. Adding the image target
      4. Adding objects
      5. Building and running
    12. Summary
  6. AR Solar System
    1. The project plan
      1. User experience
      2. AR targets
      3. Graphic assets
      4. Target device and development tools
    2. Setting up the project
      1. Creating our initial project
      2. Setting up the scene and folders
      3. Using a marker target
      4. Creating a SolarSystem container
    3. Building the earth
      1. Creating an earth
      2. Rotating the earth
      3. Adding audio
    4. Lighting the scene
      1. Adding sunlight
      2. Night texture
    5. Building an earth-moon system
      1. Creating the container object
      2. Creating the moon
      3. Positioning the moon
    6. A quick introduction to Unity C# programming
    7. Animating the moon orbit
      1. Adding the moon orbit
      2. Adding a global timescale
    8. Orbiting the sun
      1. Making the sun the center, not the earth
      2. Creating the sun
      3. The earth orbiting around the sun
      4. Tilt the earth's axis
    9. Adding the other planets
      1. Creating the planets with textures
      2. Adding rings to Saturn
      3. Switching views
    10. Using VuMark targets (Vuforia)
      1. Associating markers with planets
    11. Adding a master speed rate UI
      1. Creating a UI canvas and button
      2. Gametime event handlers
      3. Trigger input events
    12. Building and running
      1. Exporting the SolarSystem package
      2. Building for Android devices – Vuforia
      3. Building for iOS devices – Vuforia
      4. Building for HoloLens – Vuforia
      5. Building and running ARTookit
        1. ARToolkit markers
        2. Building the project for AR Toolkit
        3. Using 2D bar code targets (AR Toolkit)
    13. Markerless building and running
      1. Building and running iOS with ARKit
        1. Setting up a generic ARKit scene
        2. Adding SolarSystem
        3. Placing SolarSystem in the real world
        4. UI for animation speed
      2. Building and running HoloLens with MixedRealityToolkit
        1. Creating the scene
        2. Adding user selection of scale and time
    14. Summary
  7. How to Change a Flat Tire
    1. The project plan
      1. Project objective
      2. User experience
        1. Basic mobile version
        2. AR mobile version
        3. Markerless version
      3. AR targets
      4. Graphic assets and data
    2. Software design patterns
    3. Setting up the project
    4. Creating the UI (view)
      1. Creating an Instruction Canvas
      2. Creating a Nav Panel
      3. Creating a Content panel
      4. Adding a title text element
      5. Adding a body text element
    5. Creating an Instructions Controller
      1. Wiring up the controller with the UI
    6. Creating an instruction data model
      1. InstructionStep class
      2. InstructionModel class
      3. Connecting the model with the controller and UI
    7. Loading data from a CSV file
    8. Abstracting UI elements
      1. Adding InstructionEvent to the controller
      2. Refactoring InstructionsController
      3. Defining InstructionElement
      4. Linking up the UI elements in Unity
    9. Adding image content
      1. Adding an image to the instruction Content panel
      2. Adding image data to the InstructionStep model
      3. Importing the image files into your project
    10. Adding video content
      1. Adding video to the instruction content panel
      2. Adding video player and render texture
      3. Adding video data to the InstructionStep model
    11. Adding a scroll view
    12. Summary
  8. Augmenting the Instruction Manual
    1. Setting up the project for AR with Vuforia
    2. Switching between AR Mode
    3. Using user-defined targets
      1. Adding a user-defined target builder
      2. Adding an image target
      3. Adding a capture button
      4. Wire capture button to UDT capture event
    4. Adding visual helpers to the AR Prompt
      1. Adding a cursor
      2. Adding a registration target
      3. Removing the AR prompt during tracking
      4. Preventing poor tracking
    5. Integrating augmented content
      1. Reading the AR graphic instructions
      2. Creating AR UI elements
      3. Displaying the augmented graphic
    6. Making the augmented graphics
    7. Including the instructions panel in AR
    8. Using ARKit for spatial anchoring
      1. Setting up the project for ARKit
      2. Preparing the scene
      3. Modifying the InstructionsController
      4. Adding the AR mode button
      5. Adding the anchor mode button
      6. Adding the AR prompt
      7. Adding AR graphic content
    9. A Holographic instruction manual
      1. Setting up the project for HoloLens
      2. World space content canvas
      3. Enabling the next and previous buttons
      4. Adding an AR prompt
      5. Placement of the hologram
      6. Adding AR graphics content
    10. Summary
  9. Room Decoration with AR
    1. The project plan
      1. User experience
      2. Graphic assets
        1. Photos
        2. Frames
      3. User interface elements
      4. Icon buttons
    2. Setting up the project and scene
      1. Create a new Unity project
      2. Developing for HoloLens
      3. Creating default picture
    3. About Mixed Reality Toolkit Input Manager
      1. Gaze Manager
      2. Input Manager
        1. Mixed Reality Toolkit input events
    4. Creating a toolbar framework
      1. Create a toolbar
      2. PictureController component
      3. PictureAction component
      4. Wire up the actions
    5. Move tool, with spatial mapping
      1. Add the Move button and script
      2. Use Spatial Mapping for positioning
      3. Understanding surface planes
    6. Scale tool with Gesture Recognizer
      1. Adding the scale button and script
      2. Scaling the picture
    7. Supporting Cancel
    8. Abstract selection menu UI
    9. Adding the frame menu
      1. SetFrame in PictureController
      2. The FrameMenu object and component
      3. Frame options objects
      4. Activating the frame menu
      5. Support for Cancel in PictureController
    10. Adding the Image menu
      1. SetImage in PictureController
      2. The ImageMenu object and component
      3. Image options objects
      4. Activating the Image menu
      5. Adjusting for Image aspect ratio
    11. Adding and deleting framed pictures
      1. Add and Delete in the Toolbar
      2. GameController
      3. Add and Delete Commands in PictureController
      4. Handling empty scenes
    12. UI feedback
      1. Click audio feedback
      2. Click animation feedback
    13. Building for iOS with ARKit
      1. Set up project and scene for ARKit
      2. Use touch events instead of hand gestures
        1. PictureAction
        2. ClickableObjects
        3. ScaleTool
        4. MoveTool
    14. Building for mobile AR with Vuforia
      1. Set up project and scene for Vuforia
      2. Set the image target
      3. Add DefaultPicture to the scene
      4. GameController
      5. Use touch events instead of hand gestures
    15. Summary
  10. Poke the Ball Game
    1. The game plan
      1. User experience
      2. Game components
    2. Setting up the project
      1. Creating an initial project
      2. Setup the scene and folders
      3. Importing the BallGameArt package
      4. Setting the image target
    3. Boxball game graphics
      1. Ball game court
      2. Scale adjustments
      3. Bouncy balls
      4. Bounce sound effect
    4. Throwing the ball
      1. Ready ball
      2. Holding the ball
      3. Throwing the ball
    5. Detecting goals
      1. Goal collider
      2. CollisionBehavior component
      3. Goal! feedback
      4. Cheers for goals
    6. BallGame component
    7. Keeping score
      1. Current core UI
      2. Game controller
    8. Tracking high score
    9. Augmenting real-world objects
      1. About Vuforia Smart Terrain
      2. User experience and app states
      3. Screen space canvas
      4. Using Smart Terrain
      5. Handling tracking events
      6. App state
      7. App state manager
      8. Wiring up the state manager
    10. Playing alternative games
      1. Setting up the scene with ball games
      2. Activating and deactivating games
      3. Controlling which game to play
    11. Other toolkits
    12. Summary

Product information

  • Title: Augmented Reality for Developers
  • Author(s): Jonathan Linowes, Krystian Babilinski
  • Release date: October 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781787286436