Augmented Reality with Unity AR Foundation: A practical guide to cross-platform AR development with Unity 2020 and later versions
- Length: 382 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2021-08-16
- ISBN-10: 1838982590
- ISBN-13: 9781838982591
- Sales Rank: #2273340 (See Top 100 Books)
Explore the world of augmented reality development with the latest features of Unity and step-by-step tutorial-style examples with easy-to-understand explanations
Key Features
- Build functional and interactive augmented reality applications using the Unity 3D game engine
- Learn to use Unity’s XR and AR components, including AR Foundation and other standard Unity features
- Implement common AR application user experiences needed to build engaging applications
Book Description
Augmented reality applications allow people to interact meaningfully with the real world through digitally enhanced content.
The book starts by helping you set up for AR development, installing the Unity 3D game engine, required packages, and other tools to develop for Android (ARCore) and/or iOS (ARKit) mobile devices. Then we jump right into the building and running AR scenes, learning about AR Foundation components, other Unity features, C# coding, troubleshooting, and testing. We create a framework for building AR applications that manages user interaction modes, user interface panels, and AR onboarding graphics that you will save as a template for reuse in other projects in this book. Using this framework, you will build multiple projects, starting with a virtual photo gallery that lets you place your favorite framed photos on your real-world walls, and interactively edit these virtual objects. Other projects include an educational image tracking app for exploring the solar system, and a fun selfie app to put masks and accessories on your face. The book provides practical advice and best practices that will have you up and running quickly.
By the end of this AR book, you will be able to build your own AR applications, engaging your users in new and innovative ways.
What you will learn
- Discover Unity engine features for building AR applications and games
- Get up to speed with Unity AR Foundation components and the Unity API
- Build a variety of AR projects using best practices and important AR user experiences
- Understand the core concepts of augmented reality technology and development for real-world projects
- Set up your system for AR development and learn to improve your development workflow
- Create an AR user framework with interaction modes and UI, saved as a template for new projects
Who this book is for
This augmented reality book is for game developers interested in adding AR capabilities to their games and apps. The book assumes beginner-level knowledge of Unity development and C# programming, familiarity with 3D graphics, and experience in using existing AR applications. Beginner-level experience in developing mobile applications will be helpful to get the most out of this AR Unity book.
Table of Contents
- Setting Up for AR Development
- Your First AR Scene
- Improving the Developer Workflow
- Creating an AR User Framework
- Using the AR User Framework
- Gallery: Building an AR App
- Gallery: Editing Virtual Objects
- Planets: Tracking Images
- Selfies: Making Funny Faces
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
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Augmented Reality with Unity AR Foundation: A practical guide to cross-platform AR development with Unity 2020 and later versions
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.