Explore using user-defined targets, which will help you develop more creative augmented reality applications.
In this tutorial, we will be working with user defined targets using Vuforia in augmented reality. Until 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 we can add our own 3D object.
Note: If you don't know how to generate the license key, follow the Vuforia SDK Tutorial to learn.
- 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).
- 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're 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.
Download LinksTry 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.