Overview on Vuforia support for Unity

Vuforia is a software stack for building AR applications with a large set of carefully encapsulated advanced computer vision features. Vuforia’s recognition and tracking capabilities can be used on a variety of images and objects, like: single marker, multi-markers, cylinder targets, text and objects.

Vuforia provides tools for creating targets, managing target databases and securing application licenses.
The Vuforia Object Scanner (available for Android) helps developers to easily scan 3D objects into a format that is compatible for the Vuforia Engine to be interpreted. The Target Manager is a web application available on the developer portal that allows you to create databases of targets to be used locally on the device, or published in the cloud.
Developers building apps for optical see-through digital eyewear can make use of the Calibration Assistant which enables end users to create personalized profiles that suit their unique facial geometry.

The Vuforia Extension for Unity comes as a simple .unitypackage and allows developers to create AR applications and games easily using the Unity game engine. Installing the extension is just a matter of extracting the package inside the project and setup the provided prefabs into the scene.
Following some quick check ups before getting started.

License Key The first thing to do before starting using Vuforia, is to obtain a license key for the application to be used inside the project. The license key can be easily created using the developers portal, after subscribing as a developer.

Adding Targets In Vuforia, objects that can be identified by the computer vision system are called targets. For target binding, the extension provides a vast number of prefabs ready to be used inside the scene. Before starting using this components, however, we need to tell the scripts how these targets can be detected. We need to add a Device Database to our project; this can be done by either creating a new database or using an existing one. To create a new database we need to use Vuforia Target Manager. After that, we'll just double-click on the downloaded package to import it into the project.

vuforia prefab project folder Assets imported into the project by Vuforia. ImageTarget, Object-Target, MultiTarget are all prefabs implementing a behaviour that automatically handles the recognition and binding of one type of target.

Add AR assets and prefabs to scene Now that we have imported the Vuforia AR Extension for Unity, we can easily adapt our project to use augmented reality. First of all we need to delete (or disable) the scene Main Camera, replacing it with ARCamera from the Prefabs folder instead. This object is responsible for rendering the camera image in the background and manipulating scene objects to react to the tracked data.

  • Remember that this object needs to be configured with a legit license key.

  • The Database Load Behaviour script also needs the list of DataSets to be loaded when the application starts.

We now drag an instance of ImageTarget into the scene, the object that represents the marker inside the scene.
By looking at the Inspector we see that the object has an ImageTargetBehaviour attached, with a property named DataSet. This property contains a drop-down list of all available Data Sets for this project. When a Data Set is selected, the Image Target property drop-down is filled with a list of the targets available in that Data Set.
We can now select the DataSet and Image Target from StreamigAssets/QCAR, these are the same targets we’ve generated in the TargetManager.

Add Vuforia 3D objects to the scene We can now bind 3D content to our Image Target, we just need to place it as a child object of our ImageTarget by dragging it on top of the parent inside the Hierarchy window. We can now test the application, the results should show the 3D content under the ImageTarget bound to the physical marker.

vuforia image target example After an image with a good entropy is added to the dataset using the manager, it can be easily used as an image target.


comments powered by Disqus