How to Code an Augmented Reality Application

Want to learn skills for cutting edge technology? Augmented reality is one of the newest rising technologies on the block, yet also one of the most misunderstood. In fact, anyone who has played Pokémon Go has already used augmented reality in their life – probably without ever knowing that was what powered a large part of the app!

Nevertheless, augmented reality is quickly rising in popularity, because unlike technologies like virtual reality, almost anyone with a smartphone can utilize apps created with it. As a young industry, augmented reality also offers developers a new way to explore app creation, as bringing the virtual and real worlds together truly is unexplored territory in many ways. Thus, as many developers as possible are jumping in on the action.

However, getting started is always the hard part, so in this post we will help you both understand what AR technology is, what you can use AR to do, and how you can start developing your own AR applications with the current available technologies. If you’re ready to expand your skillset, or just want to create the next viral hit app, let’s start learning.

Phone with AR popping out from the screen

What is Augmented Reality?

Augmented reality (AR) is a technology that allows virtual objects to be placed in the real world in real time. Most commonly viewed through a mobile device, AR technology is used in a wide range of industries such as games, education, medicine, engineering, design, etc. You may have already seen some AR apps out there which places objects in the “real” world and have them track/scale as the camera moves around. How does it do this? Well it can be done in a number of different ways, with the technology improving constantly.

  • Image Targets – This is the most basic form of augmented reality. It requires you to point your device at a printed out image that the app can recognize. Based on the size, position and orientation – the app can then determine where to place the virtual object and have it track as long as the image target is in view.

zenva vr image targets

  • Plane Detection – If you have an augmented reality app that does not require image targets, it’s most likely plane detection. This means that the app is identifying feature points. These are high contrast points of interest that the camera can see. When you move around the camera, these feature points will allow the app to calculate surfaces in the world such as a floor, table or wall. It will create a large number of feature points and assign them to memory. This means that you can track one area, move to the other side of the room then return and the same feature points should still be there.

zenva ar plane detection

  • Depth Sensoring – This is the most advanced form of augmented reality and is only available on a few modern devices. It takes advantage of your mobile’s depth sensor. This is basically a camera which can see how far away things are. In terms of AR, this can mean almost instantaneous surface detection and occlusion. Occlusion is where a virtual object can go behind something in the real world. This is really only possible with depth sensoring.

unity ar depth occlusion sensor

How do I Create an AR App?

AR experiences can be created on both iOS and Android devices. Both Apple and Google have released their own AR SDK’s (software development kit – how we interact with the technology through code). Each have mostly the same features, but differ in some.

  • ARKit – Apple’s AR SDK which you can use to create AR experiences on iOS devices.
  • ARCore – Google’s AR SDK which you can use to create AR experiences on Android devices.

You can use these two SDK’s to build an AR app, but what if you want to use both? What if you want to create an AR application that can be used on both iOS and Android devices? In this case, I’d recommend you look at Unity’s AR Foundation.

What is Unity and AR Foundation?

Unity is a game engine. A game engine is basically a piece of software which allows you to develop video games. It provides you with the rendering, physics, and most of the back-end stuff so you can focus on the main aspects. Unity is a engine which focuses on both 2D and 3D games. It also has quite a robust augmented reality system.

One of the great things about Unity, is how universal it is. You can build to pretty much any device and platform there is, without needing to change much of the project at all. Their augmented reality system – AR Foundation, utilizes both ARKit and ARCore, so you can develop an app for both iOS and Android inside of the same project.

Here’s a look using AR Foundation, compared to just ARKit or ARCore. Create one project and publish to both platforms.

unity ar foundation

Basically, AR Foundation is a mixture of both the ARKit and ARCore SDK’s, so that we only ever need to create one project.

Getting Started with Unity and AR Foundation

Okay, so you want to jump into creating an AR app with Unity. You might already have some experience with engine, or none at all. First, it’s important to note that you will be doing some programming in the C# language. This is what Unity uses and there’s a large number of resources online for you to learn from. Here at Zenva, we have a large number of Unity and AR Foundation courses.

So what will you need? First, you’ll need a mobile device – and not just any. ARKit and ARCore do have certain requirements for devices.

It’s also important to note that if you wish to build to iOS, you need to have a MacOS computer. So if you’re on Windows, you unfortunately will not be able to build to iOS devices. Mac users though, can build to both iOS and Android.

Tutorials & Links

Now let’s get started with learning how to create an AR app.

Zenva Courses

AR Foundation

ARKit

ARCore

General Development Information

AR app using image recognition to label objects

Conclusion

And there we have it! Though just the first stepping stones on a long journey, hopefully you’ve learned just a little bit about augmented reality and just what you can do with it to create a unique AR experience.

The possibilities are only limited by technology itself – and with new phones coming out every year that are more and more powerful, you can bet AR is becoming a staple of the mobile app industry. Not only is the technology powering games, but also being used to train people for jobs, revolutionize education, and more. This is a train that just won’t slow down – so don’t let it ride past you. Start developing those AR skills, and make AR applications to change the world!

BUILD GAMES

FINAL DAYS: Unlock 250+ coding courses, guided learning paths, help from expert mentors, and more.