AR Game ~Research of AR Foundation~
Tags: unity3d, gamedev
Published: 2024-05-31 13:25:06

Table of contents

- Background
- What is AR foundation
- Supported device versions
- Installation of AR foundation
- Functions of AR foundation
- Next Step

# Background 
I will develop AR Game with Unity, AR foundation and so on. To learn AR development, I am researching about AR and the software related it. This blog shows the research and the process of developing AR game. If you have a question, I am happy to answer it.

# What is AR foundation 
There are many platforms for developing AR. In 2017, Apple released ARKit, which allows AR development on iOS devices.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ujtei5no9dr1of71qhg.png)

Ref: https://testgrid.io/blog/automation-testing-an-arkit-application/

In the same year, Google released ARCore, which allows AR development on Android devices.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5z4xa5k24lf599ztswjd.png)


Ref: https://developers.googleblog.com/en/announcing-arcore-10-and-new-updates-to-google-lens/

Each platform relies on the device's OS. Therefore, if you wanted to develop an AR application for both iOS and Android devices, you would need to use both platforms (ARKit and ARCore).

To solve this problem, we can use AR Foundation. It was released by Unity in 2013. By using it, developers can create AR in a single project.

# Supported device versions

A complete list of ARCore supported android smartphone can be found on the link.

https://developers.google.com/ar/devices

A complete list of ARKit supported android smartphone can be found on the link.

https://www.apple.com/in/augmented-reality/

# Installation of AR foundation

You can install AR foundation referencing the below link.

https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@5.0/manual/project-setup/install-arfoundation.html

https://developers.google.com/ar/develop/unity-arf/getting-started-ar-foundation

In May of 2024, AR Foundation 5.0 is compatible with Unity 2021.2 and up.

## How to install AR foundation Unity package.

How to install AR foundation from package manager on Unity.

1. Open Unity project
2. Window > Package Manager
3. Select Unity Registry
4. Search "AR Foundation"
5. Click **Install**

Or 
When you create a Unity project, you can choose the AR Mobile project template on Unity Hub, which sets up the necessary AR packages. You do not need to import AR foundation package individually. 

# Functions of AR foundation

The below list is the function of AR foundation. 

## Basic 

- Device Tracking
 - Track the device's position and rotation in physical space
- Manage Session
 - Enable, disable, and configure AR on the target platform
- Camera 
 - Render images from device cameras and perform light estimation
- Occlusion
 - Occlude AR content with physical objects

## Detection and Tracking

- Plane detection
 - Detect and track surfaces
- Point clouds
 - Detect and track feature points
- Anchors 
 - Track arbitrary points in space
- Image
 - Detect and track 2D images
- Object
 - Detect and track 3D objects
- Face 
 - Detect and track human faces
- Body 
 - Detect and track a human body
- Participants
 - Track other devices in a shared AR session.

## Others

- Raycasts
 - Cast rays against tracked items
- Meshing
 - Generate meshes of the environment
- Environment probes	
 - Generate cubemaps of the environment

# Next Step
I was going to display a sample AR object in Unity, but it will take a little more time. Therefore, I will show how to implement AR objects in Unity in the next post.