User Defined Targets in Augmented Reality using Vuforia
By Arshiya Sayyed
In this tutorial, we will be working with User Defined Targets using Vuforia in Augmented Reality. Till now, we have been using a marker that we used to augment a 3d model. Obviously, we can see the limitation – the technique will not work if you use any other marker except the specified one or the marker isn’t present at the moment. So let’s explore using user defined targets which will help you develop more creative applications. If you are a beginner, you can also start by checking out these augmented reality development tutorials first.
Software Requirements (Download Links at the End)
- Unity (5.4.1 32/64 bit)
- Vuforia -sample for unity
Setting user defined targets
- Create a New project in unity.
- Import the downloaded Vuforia-Samples Package.
- Search for User defined targets scene in the search box as seen in the image below and double click to open it (or right click->open).
This is the sample scene which we will be customizing and using for our augmented reality application.
- Now expand the user-defined target and delete the UserDefinedTarget_teapot as seen in the image below. The teapot is a predefined 3D object this sample scene used, we delete it so that we can add our own 3D object.
- Get the ATAT 3D model from here: Download Imperial Walker 3D Model
- Import the 3D object by clicking on asset->browse to the object->import from the menu bar.
- Generate a license key for AR camera (this is needed for the AR camera to function).
Note: If you don’t know how to generate the license key, follow the Vuforia SDK Tutorial to learn that.
- Once you are done with that, paste this key into the AR Camera license key box. You can see this by selecting AR Camera and clicking on ‘Open Vuforia Configuration’ on the right side of the screen.
- Drag and drop the imported 3D object under the user defined target as shown below.
- You are good to go! Just click on play, hold any image in front of the webcam and click on the capture icon. You should be able to see your 3D object augmented on your image based on the user defined target similar to the image below.
- Finally, you can deploy it on mobile. If you want to learn, how to do that follow the Augmented Reality Pokemon Game Using Vuforia tutorial.
Try for different images with different user-defined targets. Also, try clicking the capture button with the image close up and moving the image away from the webcam and vice versa. Holding the image up close causes the 3D object to be scaled out and holding the image far away from webcam causes the 3D object to be scaled in.
Hope you were able to make use of this tutorial for your augmented reality needs. Please drop in suggestions regarding the augmented reality topics you want to explore in the comments box below.