Map Augmented Reality journey with Unity

Over the hundreds of years of human civilization, humans have viewed the world in a number of different filters. From the filters of Gods to Greek thinkers, from stoicism to nihilism, from manual labour to industrialisation, from religion to science. All the filters exist for the sole purpose of quenching the thirst of our thinking. With each filter, we tried to wrap our lives around them and when we found a filter obsolete we tried to adopt a new one. All these filters were limited just to constructing the mental models, but little to no changes were made in how we perceive our surroundings. Now, with the advancement of science and technology we are trying to change the exact same thing – the way we perceive our surroundings i.e. our reality. This is being made possible by Augmented Reality technology.

Now let’s go and explore the full details for understanding basics of AR

What is Augmented Reality?

Over the past decade the crazy for augmented reality has grown at a tremendous rate. AR technology overlays a virtual world of images, information and highlighting effects on our world and thereby changing the way we can perceive things around us. Simply put, as we discussed in the intro, it is just a filter applied on our surroundings. But the filter is more sophisticated than the filters we ever used until now. The filter enhances everything with information and highlights what we want to highlight. For example, you equipped with this technology walked into a bookstore and wanted to find a certain book. As soon as you enter the bookstore, all the book names are to you like tags to the books you’re seeing around. You found your book and headed to the cashier section. There you take out your purse to pay the amount. For each note you hold there might appear tags again giving out what you are holding. This all sounds just. Maybe the technology might also give the name of the cashier. In each of these instances, information is overlaid on the original world. To make it more interesting, there might be a bookstore mascot ready to guide you when you entered the bookstore. This all sounds like something from movies and games and yes it is. And it is just a little away from reality.

How does it work exactly?

For now to avail the technology, you need a device with a camera such as smartphones loaded with AR software. When you point the camera to an environment, the device scans it and processes it.

There are two approaches in recognizing the objects in the scanned environment – marker and marker less. In a marker based approach where the software uses computer vision and scans for markers (like QR codes) and access information that is preprogrammed into those markers. With a marker less based approach, the software uses computer vision along with recognition algorithms to scan and recognize the objects. The recognition algorithm uses patterns, colors and other parameters in recognizing the objects.

Now the software overlays the preprogrammed information onto the real world and thereby combining virtual and real worlds.

As usual the technology can be given commands by voice, text or gestures.

What is a journey in Augmented Reality?

In AR, a journey is a new way of thinking which when applied enhances the user experience during a process. In our example of a bookstore, what you have gone through is a journey by itself for the process of buying the book you desired.

Why should organizations and companies adopt Augmented Reality?

AR’s capabilities to instruct and guide through visualization and its instructiveness helps in enhancing the decision making by reducing the cognitive load on humans. Because of its capabilities AR has many use case scenarios in almost all the industries. Medical applications like viewing anatomy for surgery, assisting the patient in navigating through the large hospitals would add great value to the services. Teaching would become more interactive and fun with AR in the rooms. Training, assembly of machines would require less supervision with the advent of the AR. There would be massive changes in the tourism industry as AR would be great at visualizing the monuments and places of travel. The use of AR in museums would make it come alive with the myriad of information that can be accessed in an interactive manner. Navigation now can become much fun with the integration of AR.

Using Unity in integrating with Augmented Reality

Unity or Unity game development software is a platform used to create games and now also to create augmented reality apps for Android and iOS phones. It is one of the most popular software or game engines to create augmented reality apps which use the AR foundation framework. AR Foundation itself makes use of the AR Core extension package by Android and AR Kit extension package by Apple. 

Now let’s get started with building a simple AR app using the AR Foundation framework in Unity game development software. Using this app we can place a simple cube in the real world.

Start Off

To start off, download Unity from their official website according to the operating system. Open Unity and create a new project with any name.

The interface of Unity primarily consists of six pieces. Project section is where you find all your project files and structures. Console section is where the errors, logs and output are displayed. Hierarchy section holds the game components which are being used in the scene. Scene is where you see your game level and the preview. Finally the Inspector, where one can tweak the properties of the game components that are being used.

Warming up

For this example we are building an app for Android. So we need to specify this to Unity by navigating to File > Build Settings and changing the platform to Android.  For installing the required packages navigate to Window > Package Manager. Install the following XRInteractionToolkit, XRManagementPlugin, ARFoundation, ARCore XR Plugin(for Android).

The App

Go to the Hierarchy section and right click to bring in AR Session, AR Session Origin, AR Default Plane, AR Placement Intractable and Cube. These are our Game Objects.

Get rid of  the default main camera as the AR Session Origin already has one. Now set the camera that is present as the main camera

Testing the App

Enable your device to install apps over USB. For the final step, navigate to File > Build and Run.

Now it is installed on your phone. Open the app and you would be able to see a cube overlaid on the camera feed of your phone.

Transitioning into a new technology is always a daunting process but when done in small steps, things are a lot easier to accommodate. Click here for the full detail on use case scenarios of Augmented Reality.

Author Bio –

Hermit Chawla is a MD at AIS Technolabs which is a Web/App design and Development Company, helping global businesses to grow by Global Clients. He love to share his thoughts on Web & App Development, Clone App Development and Game Development.