E-Book, Englisch, 382 Seiten
Linowes Augmented Reality with Unity AR Foundation
1. Auflage 2024
ISBN: 978-1-83898-296-6
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
A practical guide to cross-platform AR development with Unity 2020 and later versions
E-Book, Englisch, 382 Seiten
ISBN: 978-1-83898-296-6
Verlag: De Gruyter
Format: EPUB
Kopierschutz: 0 - No protection
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.
Autoren/Hrsg.
Fachgebiete
- Mathematik | Informatik EDV | Informatik Programmierung | Softwareentwicklung Handheld Programmierung
- Mathematik | Informatik EDV | Informatik Programmierung | Softwareentwicklung Programmier- und Skriptsprachen
- Mathematik | Informatik EDV | Informatik Programmierung | Softwareentwicklung Spiele-Programmierung, Rendering, Animation
Weitere Infos & Material
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
Preface
Augmented Reality (AR) allows people to interact meaningfully with the real world through digitally enhanced content. This book will help get you started developing your own AR applications using the Unity 3D game engine and the AR Foundation toolkit provided by Unity Technologies Inc. Using the techniques and lessons presented in this book, you will be able to create your own AR applications and games for a variety of target devices.
AR technology is now commonly available on mobile consumer devices—smartphones and tablets, both iOS (ARKit) and Android (ARCore), and a new generation of wearable smart glasses. In this book, I focus on instructing you on how to develop AR applications for mobile devices, but the techniques and projects can also be applied to wearables.
By the end of this book, you will be able to build and run your own AR applications that add layers of information to the real world, enabling interaction with real and virtual objects and innovatively engaging your users.
Who this book is for
If you want to develop your own AR applications, I recommend using Unity with AR Foundation as it is one of the most powerful and flexible platforms. Developers interested in creating AR projects can use this book to accelerate their progress on the learning curve and gain experience through a variety of fun and interesting projects. This book complements Unity's own documentation and other resources and provides practical advice and best practices that will have you up and running and productive quickly.
You do not need to be a Unity expert to use this book, but some familiarity will help you get started more quickly. If you are a beginner, I recommend you first run through one or two introductory tutorials found on Unity Learn (https://learn.unity.com/). It may also be helpful to have some experience developing for mobile devices (iOS and/or Android).
That said, I start from the very beginning, walking you along your learning curve slowly at first and then faster as you gain experience. And I provide plenty of links to external resources if you want to learn more and explore specific topics in more depth. Experienced readers can push past the instructions and explanations they already know.
What this book covers
, , after briefly defining AR, gets you set up for AR development, installing the Unity 3D game engine and the AR Foundation toolkit, and ensuring your system is ready to develop for Android (ARCore) and/or iOS (ARKit) mobile devices.
, , jumps right into building and running AR scenes, starting with examples provided in the AR Foundation samples project from Unity, and then moving on to building your own simple scene from scratch, learning about ARSession components, prefabs, and a little bit of C# coding too.
, , teaches you about troubleshooting, debugging, remote testing, and Unity MARS, which can make your development workflow more efficient.
, , sees you develop a framework for building AR applications that manages user interaction modes, user interface panels, and AR onboarding graphics, which we will save as a template for reuse in other projects in this book.
, , is where you will build a simple AR place-on-plane application using the AR user framework created in the previous chapter, including a main menu and a PlaceObject mode and UI. This chapter also discusses some advanced issues, such as making AR optional, determining device support, and adding localization to your projects.
, , is part one of a two-chapter project. Here, you will develop a picture gallery application that lets you hang virtual framed photos on your real-world walls. In the process, you will learn about UX design, managing data and objects, menu buttons, and prefabs.
, , is the second part of the Gallery project, where you will learn to implement interactions with virtual objects in your AR scene, including selecting and highlighting, moving, resizing, deleting, collision detection, and changing the photo in your picture frame.
, , shows you how to build an educational AR app that uses image tracking of Solar System "planet cards" that instantiates virtual planets hovering and spinning above your table.
, , is where you will learn to use the front-facing camera of your device to make fun and entertaining face filters, including 3D heads, face masks (with choice of material textures), and accessories such as sunglasses and mustaches. It also covers advanced features specific to ARCore and ARKit that may not be generally supported by AR Foundation itself.
To get the most out of this book
First, you need a PC or Mac capable of running Unity. The minimum requirements are not difficult; almost any PC or Mac today will be sufficient (see https://docs.unity3d.com/Manual/system-requirements.html).
If you are developing for iOS, you will need a Mac running OSX with the current version of XCode installed, and an Apple developer account. If you are developing for Android, you can use either a Windows PC or Mac.
It is not practical to develop for AR without a device capable of running your application. You should have an iOS device that supports Apple ARKit (search the web; Apple does not appear to publish a list – check here, for instance: https://ioshacker.com/iphone/arkit-compatibility-list-iphone-ipad-ipod-touch), or an Android device that supports ARCore (https://developers.google.com/ar/discover/supported-devices).
In I walk you through installing Unity Hub, the Unity Editor, XR plugins for your target device, the AR Foundation toolkit package, and other software to get you set up. The projects in this book are written and tested with Unity 2021.1.
As the technology is rapidly evolving, I try to focus on existing stable tools and techniques. Regarding software versions and installation instructions, naturally, things can change, and I recommend you use my instructions as guidelines but also look at online documentation (links usually given) for the most current instructions.
If you are using the digital version of this book, we advise you to type the code yourself or access the code from the book's GitHub repository (a link is available in the next section). Doing so will help you avoid any potential errors related to the copying and pasting of code.
Download the example code files
You can download the example code files for this book from GitHub at https://github.com/PacktPublishing/Augmented-Reality-with-Unity-AR-Foundation. If there's an update to the code, it will be updated in the GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots and diagrams used in this book. You can download it here: https://static.packt-cdn.com/downloads/9781838982591_ColorImages.pdf.
Conventions used
There are a number of text conventions used throughout this book.
Code in text: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "Utilizing the Unity Input System package, we will first add a new SelectObject input action."
A block of code is set as follows:
public void SetPlacedPrefab(GameObject prefab)
{
placedPrefab = prefab;
}
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
using UnityEngine;
using UnityEngine.InputSystem;
public class GalleryMainMode : MonoBehaviour
{
void OnEnable()
{
UIController.ShowUI("Main");
}
}
Bold: Indicates a new term, an important word, or words that you see on screen. For instance, words in menus or dialog boxes appear in bold. Here is an example: "In the New Scene dialog box, select the ARFramework template."
Tips or important notes
Appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, email us at customercare@packtpub.com and mention the book title in the subject of your message.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packtpub.com/support/errata and fill in the form.
Piracy: If...




