[Unity] The use of AR Foundation in Unity

Some time ago, in the process of comparing the effects of ARCore and ARKit environment probes through the Unity 3d packaging test, I downloaded the ARCore for Unity SDK on the Google AR Core official website, but the ARKit for Unity SDK was not found on the Apple official website. So I thought that maybe I could find it in Unity AssetStore, but the result was nothing. After many queries, I found out that Unity AssetStore was offline ARkit as early as 2018, and Unity built an AR development platform by itself, which is AR Foundation.

What is AR Foundation?

The original development process of AR-3DCAT real-time rendering cloud platform

Before the birth of AR Foundation, if we needed to develop a multi-platform AR application, we would use ARCore XR Plugin to develop an Android device version, and ARKit XR Plugin to develop an iOS device version. Due to the different underlying APIs, we need to maintain multiple copies of code at the same time, which undoubtedly increases our workload and development costs. Therefore, Unity took advantage of its cross-platform advantages to develop a platform-independent AR development kit. Unity named this AR development kit "AR Foundation".

AR Foundation itself does not implement any AR functions, but defines a multi-platform API. The AR Foundation platform is built on the AR SDK of each platform, and the AR SDK of each platform is repackaged. Its purpose is to use Unity's cross-platform capabilities to build a platform-independent AR development environment. At present, the AR SDK included in the AR Foundation includes ARCore, ARKit, Magic Leap, and Hololens. It is believed that the AR Foundation will be compatible with more mainstream AR SDKs in the future. During development, users can choose the appropriate underlying SDK version according to their project requirements.

AR Foundation simplifies the original AR development process-3DCAT real-time rendering cloud platform

AR Foundation, ARCore, and ARKit are all undergoing rapid development. ARCore basically maintains an update frequency every two months, but the implementation of AR Foundation functions is a bit later than the underlying native API. The following table shows the comparison of ARCore, ARKit, Magic Leap, and Hololens in AR Foundation:

Function comparison of ARCore, ARKit, Magic Leap, Hololens in AR Foundation

The process of packaging Android and ios with AR foundation:

Let's talk about the basic process of using AR Foundation to package to Android and ios:

The basic process of packaging to Android and ios using AR Foundation

I use the Unity version of 2019.4.14, download through the Unity Hub and install some of the necessary environments for Android and ios packaging, and there is no need to configure them separately in the future.

Android configuration process:

1. Install AR Foundation and ARCore XR Plugins in Unity's main window Windows->PackageManager (they have the same version);

2. Edit→ProjectSetting→XR Plugins-in Management→Plug-in Providers→check ARCore;

3. Edit→ProjectSetting→Player→othersetting, uncheck Multithreaded Rendering in the Other Setting tab, and finally delete Vulkan, because Android does not support Vulkan;

4. Set the minimum version of Android compatible with ARCore, find the "Minimun API level" option, click its drop-down menu, and select "Android7.0'nougat' (API level 24)" or above.

AR foundation's Android configuration process-3DCAT real-time rendering cloud platform

iOS configuration process:

Install AR Foundation and ARKit XR Plugins (their versions must be the same) in the main Unity window Windows→Package Manager;

Edit→Project Setting→XR Plugins-in Management→Plug-in Providers→check ARKit;

We set Target SDK to Device SDK. Set the minimum iOS system version to 11.0, because the minimum iOS version that supports ARKit is 11.0. Finally, set the processor architecture to ARM64.

IOS configuration process of AR foundation-3DCAT real-time rendering cloud platform

After completing the above basic settings, you can add AR basic components to the scene, click the right mouse button in the blank space in the Hierarchy window, and select XR→AR Session and XR→AR Session Origin in the pop-up cascade menu to create these two ARs. Basic components. The content can be added according to their own needs. Friends who don’t know how to develop can first download relevant samples on GitHub, with a link: github.com/Unity-Technologies/arfoundation-samples

When ARCore is packaged on Android, an error that the Gradle version is incorrect will be reported. For specific solutions, please refer to developers.google.com/ar/develop/unity/android-11-build

ARKit is packaged as an Xcode project. We need to package it in Xcode and publish it to the real machine. This link requires an Apple computer, and there are requirements for the system version and Xcode version. For detailed steps, please refer to: www.doulipark .com/2019/1122.html

After development through AR Foundation, if you want users of different devices to directly access the experience through URL, you can upload the application to the 3DCAT real-time rendering cloud platform. The user experience AR application does not need to download and install the APP, any time, place, any device can directly Visit and experience 3D applications online. The 3DCAT real-time rendering cloud platform is a hosting and operating platform for 3D applications. It provides powerful graphics real-time rendering computing services in the cloud. The platform is equipped with flexible GPU resource clusters, supports automatic load balancing and scalability, and supports massive users to access applications safely at the same time.

Guess you like

Origin blog.51cto.com/15052984/2571973