Getting Augmented with Vuforia: Guide for PlayMode (Unity plugin)

 

ezgif.com-crop

Here’s a post with information on how to install Vuforia plugin with Unity and also results of my first basic run using ImageTargets in PlayMode.

I’m currently using Alienware 15 R3 which runs the Windows 10 operating system.


 

 

Step 1: Download the plugin.

The first thing to do once you have opened up Unity and started up a new project(…sigh, I’ll wait for you to catch up…go on) is to download the free Vuforia plugin which you can access on the Asset Store. But to save precious mouse-clicks and roaming…You’re welcome.

https://www.assetstore.unity3d.com/en/#!/content/74050

Select -> Download -> Import.

Or you can get it from the Vuforia website:

https://developer.vuforia.com/downloads/sdk

Once you have this in your project folder you are pretty much half way there! No seriously… It should look like this.

UnityExtensionInProject

 

Step 2: Create a license key

So in order to use this plugin you need to register your app and get a license key which you will then need to input into your project in Unity. You do this by first going onto the Vuforia developer website and creating an account.

Once you’ve been verified then you can access the ‘Develop’ Page. You’ll see a tab that reads ‘License Manager’  – Click that then select ‘Add License Key.’

Choose your Project type and fill in the details then wala! You have a license. If only driving were that easy…

To get the key into your project. Select your App which should now be listed on the License Manager page and copy the block of text under License Key.

Screenshot (5)

Screenshot (7)

Now return to Unity and type into the search bar in your Asset folder, ‘VuforiaConfigure’. There should be a Unity Asset that appears (with the Unity icon). Click on that and in the inspector paste the key into the text input under ‘App license Key.’

Still with me?

Take a small water break and come back…

Step 3: Adding Targets

Okay! so now we can move on to adding out Image Targets. This will be the image that your program will recognize and make your model appear on top of.

Next to the ‘License Manager’ tab, you should also see a ‘Target Manager’ tab. Yes, you guessed it, click on that.

Screenshot (4)

From there – similarly to when creating a license, you should click on ‘Add Database’ (this will be the database of your targets. You can create multiple databases.) They will ask you to name your database and also choose the type. There are three types: VuMark, Device, and Cloud.

  • VuMark:
    • Similar to Device, however, allows for the subtle integration of ARTargets which can store both data and AR experiences. You can have the same design on multiple objects however still have unique data/experience with each object based on their instance ID. It’s also customisable.
  • Device:
    • Standard. Store your image/object that you’ll want to use as a Target. This will enable you to initialize AR experiences with the unity plugin
  • Cloud:
    • Allows for easy editing of Targets. ‘Real Time, Dynamic changing content’ as they say on the website. Host and manage image targets online.

 

Well, I selected Devices. Once that was done, select the database from the ‘Target Manager’ Page and then select which image you want as the target. You also have to add the dimensions(in Unity scene measures…meters I believe.)

After that has been created you can download the database which will be compressed into a unity asset which you can import straight into your project.

Screenshot (6)

Step 4: Setting up the project.

Okay so now we have all our tools in place. We can begin our first AR ImageTarget App!

First, delete the main camera from your scene and add in the Vuforia ‘ARCamera’ which is a prefab provided in your asset folder.

Then add the ‘ImageTarget’ prefab to your scene. This will handle your image target you created and the appearance of your model.

You should see a Script attached called, ‘Image Target Behaviour,’ under ‘Database’ select the database you created and imported into your project from the website (mine is ‘TargetTest.’) If it doesn’t do it automatically, you should select the image in the ‘ImageTarget’ parameter below.

 

Screenshot (3)

You should now see the Image material added as a component at the bottom. don’t worry if it still shows the Cube map. It will still work. (well it should…Fingers-crossed.)

Step 4 1/2: Check the right boxes!

Really important. Go back on the ‘VuforiaConfigure’ asset and make sure that under ‘Datasets,’ your imported data set is selected (Load ——- database). Once that box has been check another will appear called ‘Activate.’ Check that box too!

Then as we are running from PlayMode (for now) make sure that under ‘Webcam’ your preferred camera has been selected from the ‘Camera Device’ options and that the ‘Disable Vuforia PlayMode’ is unchecked.

 

Note: I’ve found if more than 2 Datasets are checked it won’t run. Don’t know if this is a bug…

Screenshot (2)

Step 5: Add your model

Now add your model as a child GameObject of the ImageTarget in the hierarchy. You can do this by dragging dropping the model asset from your asset folder, on top of the ‘ImageTarget’ name on the hierarchy. Now ‘ImageTarget’ should have a submenu with the model indented within it (mine is ‘butterfly’.)

Screenshot (1)

Step 4: Print & Run

Once all that has been done, print off the image you’ve set as a Target and you’re ready to go! Press play and hopefully you should see your model!

Note: I’ve found it doesn’t matter if the image is in black and white.

Update:

Now deployed to Samsung Galaxy S7

augmob