So, in my previous article, we walked through how to create a basic Image Target AR App in Vuforia and Unity.
Now, we’ll walk through how to create a basic Object or Model Target AR App in Vuforia and Unity.
Say you were creating an AR app and you didn’t want the user to have to carry around some target image in order to activate the projection. Say you wanted the user to just put the camera on an object near them and be able to see the projection that way.
Easy, it’s the same simple steps as before with the Image Target, just instead there will be a Model Target.
The Model Target is based off of a real-life 3D object. In order for the AR to be able to recognize this object, Vuforia requires a CAD model of the object you would like the program to detect. This way it can train the model and detect common points.
Then, it will be able to work very similarly to the Image Target, just it can work with an actual object as well!
Here’s 10 simple steps:
1. Download Unity and Vuforia and Model Target Generator
First you must download Vuforia Engine, Unity, and the Vuforia Model Target Generator. Vuforia is an extension to Unity that can give you special Augmented Reality features that add onto the typical Unity features. These include using your camera to detect perception, and location etc. Things that a typical camera couldn’t do to interact with the real world around you.
2. Download/Design a CAD model
In order to understand a 360 perspective of your IRL object, the AR application needs to analyze a digital version. This is done through CAD, or any of the resources listed. Two resources recommended by Augmented Startups are: Turbosquid, and Free3D.com. Here you can look for an image that resembles the object you will be using for the Model Target. Once you select an image, or design your own, you want to download the .obj file. (.pvz, .dae, .fbx, .igs, .iges, .stp, .step, .stl, .sla, .wrl, or .vrml are also accepted.)
3. Upload to Model Target Generator
Once you have your design, and your Model Target Generator, you want to upload the design to the Model Target Generator.
4. Train, Download, and Upload Model to Unity 3D
Once you have created the Model Target, you have to train it. First select the object, and create a guide view. Then select “Generate Model Target”. Then you can train it by creating a database. Once it’s been trained, the you must download the package so you can import it and use it in Unity.
5. Create a License Key in Vuforia
First, get a Development Key through the Vuforia website. Then copy the License Key.
6. Add AR Camera and Model Target to your Hierarchy
Through GameObject, you want to add “AR Camera” and “Model Target” to your Hierarchy on the left. This will add both things to your scene.
7. In AR Camera, Paste License Key
Open AR Camera and go to “Open Vuforia Engine Configuration” under “Vuforia Behavior” in the Inspector section on the right. Then you will paste the License Key that you created and copied from step 5.
8. In Model Target, Upload Package for Trained CAD Model
Once your Model Target has been trained, it will be ready to export into a package. As a package, you should import it to Unity. Once it has been imported to Unity, you can select the trained image as the Model Target.
9. Add Projection to the Hierarchy
Now, through GameObject you can add any object you’d like for your projection. In my situation, I added the Japanese word for Rose, ばら, to label the Model Target.
10. Test the Projection!
As in my previous article, I continued pursuing AR applications that help analyze and label objects around you in other languages. In this situation, the application detects a Rose, and labels it ばら for Rose in Japanese. This is a significant improvement from the previous project because before the application could only project on 2D images.
Now, with Vuforia’s Model Target Generator, the application can detect objects surrounding us and actually have a greater impact in analyzing surrounding objects and using them to increase our vocabulary while language learning.
Next, I hope to continue experimenting with Vuforia’s Model Target Generator and creating even more variations for targets to increase the impact of objects around us!
My name is Alyssa Gould and I’m really passionate about using AR/AI to help Second Language Acquisition.
My email is email@example.com if you would like to chat about my work or any potential opportunities!