Augmented reality (AR) is taking an increasingly firm hold in many industries.
This technology of overlaying virtual objects over the real surroundings has stepped far beyond its initial use cases of games and other entertainment products.
In 2018, AR became a useful tool for education, e-commerce, advertising, construction and design, and professional training. In each of these and other industries, augmented reality finds new formats allowing achieving maximum efficiency.
Naturally, this trend has called for an increased demand for AR application development.
The industry of AR development tools, frameworks and environments are keeping with this trend offering new solutions that can make augmented reality creation easier.
Vuforia and Unity3D are go-to tools for AR development
Vuforia is an advanced AR building engine that provides an intuitive platform for creating augmented reality apps for Android and iOS platforms.
Vuforia has earned the developers’ appreciation for its broad functionality and compatibility with other tools.
Since many AR apps include the appearance of virtual 3D objects over the real world, building such applications requires a 3D design tool where such objects called 3D models can be created.
The top of the rating of such tools is occupied by Unity3D, a powerful game engine allowing building 2D and 3D scenes, games and simulations.
Vuforia and Unity3D have been used together to create AR applications for quite some time.
Since 2017, Unity3D offers built-in support of Vuforia allowing creating AR projects easier. Vuforia support is included in Unity 3D 2017.2 and later versions.
Let’s see how augmented reality can be developed using Vuforia and Unity3D.
In this case, Vuforia provides the printable image targets that will trigger the appearance of 3D objects created in Unity3D. Or, you can specify the object that the application should recognize to produce AR content.
For such a project, you need a Vuforia account and a Unity ID.
Besides, Vuforia requires each application to have a unique license key. You can create the license key by logging in to the Vuforia Developer Portal where a unique key will be generated.
Getting started with Vuforia and Unity3D
To start your first project with Vuforia and Unity3D, download the Unity3D version that supports Vuforia.
During the package installation, mark Vuforia Augmented Reality Support together with the support of iOS or Android, or both.
After the successful download and installation, create your project in Unity3D. For AR apps, mark it as a 3D project in the dialog window.
Now that your project is created, you can proceed with activating Vuforia and making other settings needed to build an augmented reality app.
Activating Vuforia in Unity3D
To activate Vuforia, navigate to the Project Settings in Unity3D, select Player and choose the mobile device for which you are creating the application.
Under XR Settings, choose Vuforia from the Virtual Reality SDKs list and mark the Vuforia Augmented Reality Supported checkbox.
Now Vuforia support is activated in your Unity3D.
To build augmented reality applications, you need to activate the AR camera.
Under the GameObject menu, select Vuforia -> AR Camera. After that, the Main Camera in the Hierarchy tab will be replaced with AR Camera.
At this stage, you may be prompted to download Vuforia Assets if this is your first project using Vuforia. Import the assets, and Unity3D will download all asset files that are available.
To complete the Vuforia setup, you need to enter the application license key that you generated in the Vuforia Developer Portal.
Select AR Camera in the Hierarchy tab and in the Inspector window that follows, click Open Vuforia Configuration.
Copy the license key and paste it in the App License Key field. Click Add License to finish Vuforia setup.
This completes the configuration of your Vuforia-Unity3D project.
To test it, click Play in your Unity3D editor window. If all components have been installed correctly, the video feed from your web camera will be played.
Now, you are ready to start creating your AR application.
Configuring image targets
Image targets trigger the appearance of virtual objects in an augmented reality app. The corresponding target should be specified so that the app recognizes it.
To set up the image targets, move back to the Vuforia Developer Portal and open the Target Manager page. Use the Add Database button to proceed to the Create Database page where you can set up your target image database.
Type the name of your database and select Device as its type. Clicking Create adds a new database. It will appear in the list of databases on the Target Manager page.
Now, let’s add images that will serve as targets for the virtual objects.
On the Target Manager page, open your database by clicking its name. Click the Add target button to find and select the target images.
Vuforia supports four types of targets – Single Image, Cuboid, Cylinder, and 3D Object. You can select any type and then browse your computer for the corresponding object.
Let’s select Single Image and choose an image to act as the target.
Set the image name and width so that Unity3D can use it as the size reference. Vuforia also adds the star rating showing how easy it will be for the camera to recognize your image. Aim for 5 stars.
Finally, you need to download your database so that it can be used in Unity3D.
Click Download Database in your database window and select Unity Editor as the development platform. Click Download to complete the database setup.
Now, everything is set up to build the augmented reality.
Adding image targets and 3D objects
Return to Unity 3D and open the GameObject menu. Select Vuforia -> Image. That opens the Inspector dialog window where you can choose the database you created and the image you added to it.
The image target appears on your Hierarchy screen and can be used to connect to the 3D object. Click it and select the type of object you would like to appear in your AR application.
Unity3D has a number of default 3D objects, but, of course, you can create your own – that’s what Unity3D is for.
For example, if you have selected a default cube, it will appear once the camera recognizes your target image. Tweak the cube settings, so that its dimensions match those of your target – and you are all done!
Click Play to see your augmented reality working. As soon as your target gets within the range of your camera, a virtual cube appears.
Congratulations, you have built your first augmented reality application for a mobile device.
From our description, it may seem that it is easy and that creating AR requires no special skills.
True, the advanced tools make the development extremely straightforward, and their integrations allow setting up the environments easily.
So, what’s the catch? Why haven’t AR development companies all gone bankrupt? The thing is that hardly any business wants cubes and cylinders to act as AR objects.
What today’s business wants are animated lifelike objects that users can interact with on the device screen.
Behind any unique AR app, there are hours of work of 3D artists and designers, mobile platform experts, testers, project managers, support engineers.
Their combined expertise and knowledge make a one-of-a-kind product that will work on multiple devices, be responsive and secure, create the intended experience, and be easily adaptable to new requirements.
This is why professional AR development is now in huge demand. This is why we have cherry-picked a brilliant team capable of building AR apps of any complexity.
If you are planning to enhance your business with augmented reality, we will be happy to help.
Let’s build augmented reality together, and you will be amazed at the results!