Home Page Icon
Home Page
Table of Contents for
Augmented Reality with Unity AR Foundation
Close
Augmented Reality with Unity AR Foundation
by
Augmented Reality with Unity AR Foundation
Augmented Reality with Unity AR Foundation
Contributors
About the author
About the reviewers
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Download the color images
Conventions used
Get in touch
Section 1 – Getting Started with Augmented Reality
Chapter 1: Setting Up for AR Development
Technical requirements
Defining Augmented Reality
Getting started with Unity
Installing Unity Hub
Installing a Unity Editor
Creating and managing Unity projects
Introducing the Unity Editor interface
Basics of using the Unity Editor
Organizing your project assets
Preparing your project for AR development
Installing XR plugins for AR devices
Installing the AR Foundation package
Choosing an input handler
Adding support for the Universal Render Pipeline
Setting up for mobile development
Setting up for Android/ARCore development
Setting up for iOS/ARKit development
Developing for wearable AR glasses
Building and running a test scene
Summary
Chapter 2: Your First AR Scene
Technical requirements
Exploring the AR Foundation example projects from Unity
Building and running the Samples project
Exporting the sample assets for reuse
Building the SimpleAR scene in your own project
Creating a new project
Importing the Sample assets into your own project
Starting a new, basic AR scene
Using AR Session
Using AR Session Origin
Using the AR Camera
Adding Plane and Point Cloud managers
Adding AR Raycast Manager
Adding Light Estimation
Building and running the scene
Placing an object on a plane
Setting up a PlaceObject input action
Introducing Unity C# programming and the MonoBehaviour class
Writing the PlaceObjectOnPlane script
Building and running the scene
Refactoring your script
Creating a prefab for placing
Understanding GameObjects and Transforms
Finding a 3D model
Completing the scene
Summary
Chapter 3: Improving the Developer Workflow
Technical requirements
Troubleshooting with log messages
Using Debug.Log
Using the Console with a mobile device
Simulating a Console window in your app
Debugging with a debugger
Debugging on a remote device
Testing with an editor remote tool
Simulating with Unity MARS
Capturing with the MARS Companion app
Summary
Section 2 – A Reusable AR User Framework
Chapter 4: Creating an AR User Framework
Technical requirements
Understanding AR interaction flow
Installing prerequisite assets
TextMeshPro
DOTween
Serialized Dictionary Lite
Other prerequisite assets
Starting with a new scene
Creating the UI canvas and panels
Creating the screen space canvas
Adding an app title
Creating the UI panels
Creating the UI controller
Creating a Singleton class script
Writing the UIController script
Fading the UI panels
Creating an Interaction Controller mode
Creating the interaction mode hierarchy
Writing the Interaction Controller
Creating the interaction modes behavior
The StartupMode script
The ScanMode script
The MainMode script
The NonARMode script
Testing it out
Using the Unity onboarding UX assets
Introducing the onboarding assets
Preparing the Unity AR onboarding assets
Installing dependency packages
Importing the OnboardingUX package
Writing the AnimatedPrompt script
Integrating the onboarding graphics
Creating a scene template for new scenes
Summary
Chapter 5: Using the AR User Framework
Technical requirements
Planning the project
Starting with the ARFramework scene template
Adding a main menu
Adding PlaceObject-mode with instructional UI
Creating the PlaceObject UI panel
Creating the PlaceObject mode
Wiring the menu buttons
Performing a Building and Run
Hiding tracked objects when not needed
Advanced onboarding issues
Making an AR-optional project
Determining whether the device supports a specific AR feature
Adding localization
Summary
Section 3 – Building More AR Projects
Chapter 6: Gallery: Building an AR App
Technical requirements
Specifying the Art Gallery project UX
Project objectives
Use cases
UX design
User stories
Getting started
Collecting image data
Importing photos to use
Adding image data to the scene
Obtaining the pixel dimensions of an image
Loading the pictures list at runtime
Creating a framed photo prefab
Creating the prefab hierarchy
Writing a FramedPhoto script
Scaling the picture's shape
Hanging a virtual photo on your wall
Detecting vertical planes
Creating the AddPicture UI panel
Writing the initial AddPictureMode script
Creating the AddPicture Mode object
Creating a main menu Add button
Build And Run
Completing the AddPictureMode script
Showing tracked planes in AddPicture mode
Selecting an image to use
Creating the SelectImage mode
Creating the Select Image UI panel
Creating an Image Button prefab
Writing an ImageButtons script
Reroute the Add button
Adjusting for image aspect ratio
Summary
Chapter 7: Gallery: Editing Virtual Objects
Technical requirements
Creating an Edit mode
Creating an edit menu UI
Creating EditPicture mode
Selecting a picture to edit
Defining a SelectObject input action
Replacing the MainMode script
Selecting an object from Main-mode
Wiring the Done edit button
Highlighting the selected picture
Selecting an object from Edit mode
Avoiding intersecting objects
Deleting a picture
Replacing the picture's image
Replacing the frame
Interacting to edit a picture
Ensuring FramedPhoto objects receive Input Action messages
Adding the interaction components
Using our finger to move the picture
Pinching to resize the picture
Summary
Chapter 8: Planets: Tracking Images
Technical requirements
Understanding AR image tracking
Specifying the Planets project
User experience flow
Preparing the planet cards
Collecting planet textures and data
Getting started
Tracking reference images
Adding AR Tracked Image Manager
Creating a reference image library
Configuring the user interaction modes and UI
Scanning for reference images
Build and run
Creating and instantiating a virtual Earth prefab
Creating the generic Planet Prefab
Understanding equirectangular images
Creating the Earth prefab
Adding planet metadata
Animating the planet's rotation
Building the app's Main-mode
Writing the PlanetsMainMode script
Expanding the project with multiple planets
Adding the planet card image to the Reference Image Library
Creating the planet prefab
Responding to detected images
Making a responsive UI
Creating the Main-mode UI
Pointing the camera to show information
Displaying information details
Summary
Chapter 9: Selfies: Making Funny Faces
Technical requirements
Understanding face tracking
Face tracking versus face identification
Tracking a face with AR Foundation
Getting started
Creating a new scene using the ARFramework template
Setting up iOS ARKit for face tracking
Importing assets used in this project
Configuring a new AR scene for face tracking
Setting the AR camera for selfies
Adding an AR Face Manager component
Prompting the user to find a face, or not
Build and run
Tracking the face pose with 3D heads
Making a Mr. Plastic Head prefab
Making a Mr. Facet Head prefab
Building the Main mode and menu
Creating a changeable face prefab
Writing a main mode controller script
Creating scrollable main menu buttons
Adding a reset face button
Attaching 3D Accessories
Wearing a hat
Sporting cool sunglasses
Updating the scripts for accessories
Adding accessories to the main menu
Making dynamic face meshes with a variety of materials
Exploring AR Default Face
Creating face materials
Adding a face mesh visualizer to the changeable face prefab
Controlling the face material
Adding face materials to the main menu
Using eye tracking (ARKit)
Attaching stickers to face regions (ARCore)
Creating the sticker prefabs
Managing attachments' positions
Adding region attachments to the main menu
ARCore-only UI buttons
Tracking expressive face blend shapes (ARKit)
Summary
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Augmented Reality with Unity AR Foundation
Next
Next Chapter
Preface
Table of Contents
Preface
Section 1 – Getting Started with Augmented Reality
Chapter 1
: Setting Up for AR Development
Technical requirements
Defining Augmented Reality
Getting started with Unity
Installing Unity Hub
Installing a Unity Editor
Creating and managing Unity projects
Introducing the Unity Editor interface
Basics of using the Unity Editor
Organizing your project assets
Preparing your project for AR development
Installing XR plugins for AR devices
Installing the AR Foundation package
Choosing an input handler
Adding support for the Universal Render Pipeline
Setting up for mobile development
Setting up for Android/ARCore development
Setting up for iOS/ARKit development
Developing for wearable AR glasses
Building and running a test scene
Summary
Chapter 2
: Your First AR Scene
Technical requirements
Exploring the AR Foundation example projects from Unity
Building and running the Samples project
Exporting the sample assets for reuse
Building the SimpleAR scene in your own project
Creating a new project
Importing the Sample assets into your own project
Starting a new, basic AR scene
Using AR Session
Using AR Session Origin
Using the AR Camera
Adding Plane and Point Cloud managers
Adding AR Raycast Manager
Adding Light Estimation
Building and running the scene
Placing an object on a plane
Setting up a PlaceObject input action
Introducing Unity C# programming and the MonoBehaviour class
Writing the PlaceObjectOnPlane script
Building and running the scene
Refactoring your script
Creating a prefab for placing
Understanding GameObjects and Transforms
Finding a 3D model
Completing the scene
Summary
Chapter 3
: Improving the Developer Workflow
Technical requirements
Troubleshooting with log messages
Using Debug.Log
Using the Console with a mobile device
Simulating a Console window in your app
Debugging with a debugger
Debugging on a remote device
Testing with an editor remote tool
Simulating with Unity MARS
Capturing with the MARS Companion app
Summary
Section 2 – A Reusable AR User Framework
Chapter 4
: Creating an AR User Framework
Technical requirements
Understanding AR interaction flow
Installing prerequisite assets
TextMeshPro
DOTween
Serialized Dictionary Lite
Other prerequisite assets
Starting with a new scene
Creating the UI canvas and panels
Creating the screen space canvas
Adding an app title
Creating the UI panels
Creating the UI controller
Creating a Singleton class script
Writing the UIController script
Fading the UI panels
Creating an Interaction Controller mode
Creating the interaction mode hierarchy
Writing the Interaction Controller
Creating the interaction modes behavior
The StartupMode script
The ScanMode script
The MainMode script
The NonARMode script
Testing it out
Using the Unity onboarding UX assets
Introducing the onboarding assets
Preparing the Unity AR onboarding assets
Installing dependency packages
Importing the OnboardingUX package
Writing the AnimatedPrompt script
Integrating the onboarding graphics
Creating a scene template for new scenes
Summary
Chapter 5
: Using the AR User Framework
Technical requirements
Planning the project
Starting with the ARFramework scene template
Adding a main menu
Adding PlaceObject-mode with instructional UI
Creating the PlaceObject UI panel
Creating the PlaceObject mode
Wiring the menu buttons
Performing a Building and Run
Hiding tracked objects when not needed
Advanced onboarding issues
Making an AR-optional project
Determining whether the device supports a specific AR feature
Adding localization
Summary
Section 3 – Building More AR Projects
Chapter 6
: Gallery: Building an AR App
Technical requirements
Specifying the Art Gallery project UX
Project objectives
Use cases
UX design
User stories
Getting started
Collecting image data
Importing photos to use
Adding image data to the scene
Obtaining the pixel dimensions of an image
Loading the pictures list at runtime
Creating a framed photo prefab
Creating the prefab hierarchy
Writing a FramedPhoto script
Scaling the picture's shape
Hanging a virtual photo on your wall
Detecting vertical planes
Creating the AddPicture UI panel
Writing the initial AddPictureMode script
Creating the AddPicture Mode object
Creating a main menu Add button
Build And Run
Completing the AddPictureMode script
Showing tracked planes in AddPicture mode
Selecting an image to use
Creating the SelectImage mode
Creating the Select Image UI panel
Creating an Image Button prefab
Writing an ImageButtons script
Reroute the Add button
Adjusting for image aspect ratio
Summary
Chapter 7
: Gallery: Editing Virtual Objects
Technical requirements
Creating an Edit mode
Creating an edit menu UI
Creating EditPicture mode
Selecting a picture to edit
Defining a SelectObject input action
Replacing the MainMode script
Selecting an object from Main-mode
Wiring the Done edit button
Highlighting the selected picture
Selecting an object from Edit mode
Avoiding intersecting objects
Deleting a picture
Replacing the picture's image
Replacing the frame
Interacting to edit a picture
Ensuring FramedPhoto objects receive Input Action messages
Adding the interaction components
Using our finger to move the picture
Pinching to resize the picture
Summary
Chapter 8
: Planets: Tracking Images
Technical requirements
Understanding AR image tracking
Specifying the Planets project
User experience flow
Preparing the planet cards
Collecting planet textures and data
Getting started
Tracking reference images
Adding AR Tracked Image Manager
Creating a reference image library
Configuring the user interaction modes and UI
Scanning for reference images
Build and run
Creating and instantiating a virtual Earth prefab
Creating the generic Planet Prefab
Understanding equirectangular images
Creating the Earth prefab
Adding planet metadata
Animating the planet's rotation
Building the app's Main-mode
Writing the PlanetsMainMode script
Expanding the project with multiple planets
Adding the planet card image to the Reference Image Library
Creating the planet prefab
Responding to detected images
Making a responsive UI
Creating the Main-mode UI
Pointing the camera to show information
Displaying information details
Summary
Chapter 9
: Selfies: Making Funny Faces
Technical requirements
Understanding face tracking
Face tracking versus face identification
Tracking a face with AR Foundation
Getting started
Creating a new scene using the ARFramework template
Setting up iOS ARKit for face tracking
Importing assets used in this project
Configuring a new AR scene for face tracking
Setting the AR camera for selfies
Adding an AR Face Manager component
Prompting the user to find a face, or not
Build and run
Tracking the face pose with 3D heads
Making a Mr. Plastic Head prefab
Making a Mr. Facet Head prefab
Building the Main mode and menu
Creating a changeable face prefab
Writing a main mode controller script
Creating scrollable main menu buttons
Adding a reset face button
Attaching 3D Accessories
Wearing a hat
Sporting cool sunglasses
Updating the scripts for accessories
Adding accessories to the main menu
Making dynamic face meshes with a variety of materials
Exploring AR Default Face
Creating face materials
Adding a face mesh visualizer to the changeable face prefab
Controlling the face material
Adding face materials to the main menu
Using eye tracking (ARKit)
Attaching stickers to face regions (ARCore)
Creating the sticker prefabs
Managing attachments' positions
Adding region attachments to the main menu
ARCore-only UI buttons
Tracking expressive face blend shapes (ARKit)
Summary
Other Books You May Enjoy
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset