ARCore: Diving into the world of Augmented Reality

Shivang Chopra
Coding Blocks
Published in
6 min readJun 29, 2018

Huge advances in the field of Computer Vision has paved the path for one of the most exciting fields of Mobile-Platform based Augmented Reality. Apple’s ARKit and Google’s ARCore are one of the finest frameworks available to develop Augmented Reality apps. This short tutorial will be covering the basic working of Google’s ARCore and it’s integration with Unity Game Engine.

What is Augmented Reality?

Augmented reality (AR) is a view of things of real world enriched (augmented) by video, GPS, graphics or sound. This technology helps to enhance human perception of reality. In Augmented Reality, physical real-world environments are augmented with superimposed computer-generated images over a user’s view of the real-world, thus enhancing one’s current perception of reality.

Types of Augmented Reality

  • Marker-Based Augmented Reality uses a camera and some type of visual marker, such as a QR/2D code, to produce a result only when the marker is sensed by a reader.
  • Marker-Less Augmented Reality uses a GPS, digital compass, velocity meter, or accelerometer which is embedded in the device to provide data based on your location.
  • Projection Based Augmented Reality allows for human interaction by sending light onto a real world surface and then sensing the human interaction (i.e. touch) of that projected light.
  • Superimposition Based Augmented Reality either partially or fully replaces the original view of an object with a newly augmented view of that same object.

How does ARCore work?

Before diving into development, let’s look into what’s under the hood of Google’s SDK.

Fundamentally, ARCore uses three key capabilities to integrate virtual content with the real world as seen through your phone’s camera:

  • Motion Tracking allows the phone to understand and track its position relative to the world. ARCore uses an algorithm called Concurrent Odometry and Mapping (COM) to understand where the phone is relative to the world around it.
  • Environmental Understanding allows the phone to detect the size and location of all type of surfaces: horizontal, vertical and angled surfaces like the ground, a coffee table or walls. ARCore looks for clusters or feature points that appear to lie on common surfaces such as desks, chairs, etc. and makes these surfaces available to your device as ground planes.
  • Light Estimation allows the phone to estimate the environment’s current lighting conditions and lets you light your virtual objects under the same lighting condition.

ARCore was essentially derived from Google’s Project Tango which had special hardware to do it’s AR. Unfortunately, it wasn’t practical to implement this hardware on all the devices. Therefore, ARCore emerged after the likes of ARKit.

Setting up your first ARCore project in Unity3D

Before starting with the project, it is important to note that, because ARCore is a relatively new SDK, only a limited number of mobile devices are supported. Make sure you have access to one of them in order to work on this platform.

You can get a list of the supported devices here:-

Let’s first start by importing and playing around with the official HelloAR project. After that we can start making new apps using the official app as a framework.

Step 1: Go ahead to the following link and download Unity3D. Make sure to download version 2017.4 or later.

Step 2: During installation, select Android Build Support in the components section.

Step 3: Head over to this link and download Android Studio.

Step 4: Open Unity3D and create a new project names ARCore101. Make sure to select 3D in the template section.

Step 5: After the project is created, head over to Unity->Unity Preferences->External Tools. Add the path of Android SDK and Android JDK taken from Android Studio into the respective fields.

Step 6: Go to File->Build Settings, select Android in the Platforms list. Then click Switch Platform. The unity logo should appear in front of Android in the platforms list.

Step 7: Download ARCore SDK for Unity from the following link:

Step 8: Right click in the Assets window->Import Package->Custom Package and select the downloaded ARCore SDK.

Step 9: Click on All and then Import in the dialog box that appears.

Step 10: The Asset window should look like this.

Step 11: Go to Assets->GoogleARCore->Examples->Scenes and open HelloAR scene.

Step 12: Go to File-> Build Settings and click on Player Settings.

Step 13: The following window will appear in the Inspector.

Step 14: In the Inspector window, configure the following settings:

Step 15: Save the scene, go to File->Build Settings, click on Add Open Scenes and deselect Scenes/SampleScene.

Step 16: Connect your Android device with USB Debugging Enabled and then go to File->Build Settings and click Build And Run. Save the build and wait for the app to build on your device.

Step 17: Play with the app on your Android device. Make sure to search for surfaces with a texture, as plane surfaces are not detected by ARCore SDK. Touch on the screen to spawn an Android Object at the desired spot in Augmented Reality.

That’s it! I hope you liked this post. If you did, don’t forget to 👏.

Next Up: Motion Tracking in ARCore.

--

--