Tutorial on Augmented Reality (AR) using Unity

Augmented reality with Unity is used worldwide nowadays and its trending everywhere.

Photo from https://www.threekit.com/

Let’s start with what is Augmented Reality:

Augmented reality(AR) is just like a real world with virtual component added to it. In other words, AR is technology which can superimpose digital content over real-world those can be images, sounds, text etc.

According to Wikipedia, Augmented reality (AR) is a live direct or indirect view of a physical, real-world environment whose elements are “augmented” by computer-generated or extracted real-world sensory input such as sound, video, graphics or GPS data.

Real view can be modified by android or iOS devices, it works on real world to add/impose virtual element.

AR supports almost all new trend of business like Shopping, Education, Health, home Decoration, mobile gaming.

What is Unity:

Unity is one real-time development platform which supports to create 2D, 3D, AR, VR, mobile, console which includes any type of versatile gaming platform. It has powerful cross-platform 3D engine and very easy to use(user friendly), and also free for learning & personal use. It provide many more important built-in features like Coroutine, physics, 3D rendering.

Advantages of Unity:

1.Creates standalone applications.

2.It would help to integrate, overlay and animate 3D objects on camera.

3.It also empowers graphics with shading , also enhances other effects like bringing audio to the next level.

4.Many more options to deploy more than 25+ popular platforms and technologies like iOS, Windows, Android, Linux, WebGL, PS4, PlayStation VR etc.

Disadvantages of Unity with AR:

1.All the API are bind together that we are bound to use it so basically no important changes can be made without the Unity Editor.

2.More computing resources are used for various games as many background processes are running which are not in use, this consumes lot of unrequired resources.

3.This framework is not suitable for large scale projects.

Pros and Cons of Unity for Android/iOS app:

Pros:

1.Awesome tool to develop standalone as well as mobile application for AR and VR development.

2.It supports multiple platforms, same script can be complied for various platforms.

3.Latest version of Unity is integrated with Vuforia augmented reality plugins.

Cons:

1.As it has new version released it is always difficult to work with because it might contain various bugs and difficult to find the issues which might delay the easy deployments.

2.Various android and iOS UI components can’t be easily implemented to Unity.

3.Unity includes features from various platform as well as unique feature from unity which includes device optimization.

Unity Installation Steps:-

Over here we will learn how to install Unity on windows platform

Step-1. Use URL- https://unity.com/ or search on google with Unity keywords, Installation is very simple, just create your account with very basics information on Unity portal.

After submitting required details, you will get confirmation mail on given email, you have to confirm it.

Step-2. After creating account on Unity portal, it’s time to choose Plan as per requirement and price.

There are two type of Plans- Individual & Teams, we can take these as personal and professional usages,

Individual is for learning and personal usages, it’s completely free and Teams is paid and provide many more advance feature like account can be created including you and your team together, Unity teams is simple to store, share and can make sync your projects within teams.

Step-3. For learning purpose, you can move with individual and with Student/Personal.

Now you have to set installation path, which can be chosen by default but we can make changes as per requirement.

Step-4. We have to sign with Unity ID or if you don’t have then we have to create one( If don’t have ID, take reference of step-1).

Step-5. Select 3D and give Project name & location.

Step-6. After creating project, you will land on Unity interface to work.

The Unity application is a complete 3D environment, suitable for laying out levels, creating menus, doing animation, writing scripts, and organizing projects. The user interface is well organized and the panels can be fully customized by dragging and dropping.

Unity elements which support to AR

Image tracking- Detect 2D images , AR application can be changed based on the image present.

3d Object tracking- Helps in detecting digital representation of real world objects. Detected object enable applications to change based on object present in the real world.

Meshing- It generates triangle meshes that directs to the physical spaces has capability to interact with representation of the physical environment.

Face tracking- Represents face, different shapes which can feed into the facial animation.

Device Tracking- Helps to track the device indentation and location in physical world.

Raycast- Commonly used in video game development. A Raycast is a ray that gets sent out from a position in 3D or 2D and get moved to the particular direction.

Plane Detection- Planes detect the size of horizontal and vertical areas.

Point cloud detection- These are the points which gets captured in the camera by detecting features and helps to use these points to understand where the device is located to the world.

Environment probes- it helps in identifying the lighting and color information which helps to enable 3D content.

2D and 3D body tracking- Provides 2D and 3D representation of humans in camera frame, For 2D humans are represented by 17 joints and for 3D humans are represented by 93 joints.

Human segmentation- Human body provides apps with human stencils. The stencil segmentation image shows pixel.

Occlusion- Unity will ensure only visible objects get sent to be rendered, this reduces the number of cells and also increases the performance of the game.

Basic Set-up for AR

AR foundation Package

  1. After installation steps, navigate to Package manager — Windows > Package manager .
  2. Search AR foundation and install it.
  3. If you are planning to deploy project on iOS, install ARKit plugin. In case of Android, go with ARCore XR plugin.
  4. In case of iOS and Android, install both.
  5. Add AR session Origin GameObject, navigate to Create > XR > AR Session Origin.
  6. Setup Build Settings, you will get option to choose target of project development to iOS/Android, navigate to File > Build Settings.

Conclusion

Congratulations on completing this tutorial for AR with Unity…!! Using this tutorial you understand the basic concepts or AR with Unity and its main features. As per the concept explained with liberation and limitations its easily understandable to go and choose AR with Unity for developing AR projects. From here , you can proceed and complete setup for starting with AR project you wish for. And now you should also have a fair knowledge on how the projects can be created using Augmented reality.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ankit Chaudhari

Working as freelancer with 9+ years of industry experience as Data Analyst