If you have a 3D model of a physical object, you can import that digital model into the Model Target Generator (MTG) desktop tool and generate a Model Target for tracking the physical object. The MTG supports a variety of file formats and model types and provides various options to configure your target for optimal detection and tracking performance. This article provides a step-by-step introduction to the MTG and the generation of a Model Target.
Installing the MTG
Follow the Model Target Generator User Guide to download and install the MTG.
Launching the MTG
- Open the Model Target Generator from the location where you installed it or via the shortcut.
- A login dialog opens where you must enter your Vuforia Developer account credentials. See How To Register as a Vuforia Developer if you do not yet have an account.
Creating a Model Target
The MTG package includes the NASA Viking Lander as a 3D model.
- Click Create New Model Target (or select Open Model Target to open a previously created project).
- Click Select... and ensure the Location field is not set to an unmapped network path.
- Open VuforiaMars_ModelTarget.pvz, located at: \resources\sampledata\VuforiaMars_ModelTarget
By default, the Model Target Name is filled with the same name as the CAD model file. It can be changed if you so wish.
- Click Create Model Target.
The model displays in the 3D viewer alongside an introductory message.
- You may choose to press Continue or Never Show Again to close the message.
- You may choose to press Continue or Never Show Again to close the message.
The top bar in the MTG presents a number of tabs where each represents a step in configuring your model for generating a suitable Model Target. Once a step is complete, the tab will be highlighted in green and the meter in the upper right corner may increase its progress. When the progress meter turns green, the MTG has determined that the Model is fully configured and ready to be generated as a Model Target. Evidently, it does not matter which order you go through the tabs. Expert users may skip some tabs and generate a Model Target even when the progress meter is ‘low’.
NOTE: Re-importing a model will require you to repeat some steps, such as Coloring.
In the 3D view pane, use the Rotate, Zoom, and Pan icons to navigate around the model to inspect it for missing parts or incorrect normals. Refer to the Model Targets Supported Objects & CAD Model Best Practices article for more information.
The tab which your model is loaded in, is used to adjust orientation of the imported model.
- Select and Confirm the preview that aligns the plane with your model. Choose the Up Vector from the directions: X, Y, Z, -X, -Y, and -Z.
The size of the Model Target needs to match the size of the object in the physical world. Since the model units are usually not encoded in a CAD model, it is necessary to select the correct units (e.g. meters, feet, centimeters, etc.). In the 3D view window, the current interpreted size is displayed.
- Select the File Units to match the size of the physical object.
NOTE: The unit selected does not re-scale the 3D model. Instead, the unit specifies how a unit of one is interpreted. Rescaling the model is not supported in the MTG because it is designed to be a 3D model viewer, and not a mesh editor. You may need to change the size of the CAD model using its creation tool. Alternatively, try a different model file format. Some file formats, such as obj, are unit agnostic. Also, be attentive to the model scale when importing the Model Target database into Unity. This vigilance ensures that the sizing is consistent throughout the development process. More information on scaling Model Targets can be found in the Best Practices for Scaling Model Targets.
Imported models that consist of multiple parts and do not include texture or multiple colors are recommended to receive automatic coloring by the MTG. Coloring the different parts of a model can help to improve tracking performance. Models that consist of a single mesh would only receive a single color and therefore no improved tracking. Models with textures do not need coloring and – assuming the texture represents the physical object – select the Realistic Appearance setting before going to the next step.
- In our case, the model that came with the MTG consists of multiple parts and no texture. Select the Non-Realistic Appearance and click Apply Coloring to automatically color the model. Coloring can always be undone. For a complete guide on coloring, please see Automatic Coloring of Model Targets.
This tab measures the complexity of your model which should be under a certain number of vertices and parts; see CAD Model Best Practices for recommended model specifications and steps to reduce complexity. The Model Target Generator also offers a possibility to simplify the model directly before generating the Model Target. This will require uploading the model to the Vuforia servers. See MTG Data Processing for more information.
Exceeding the model recommendations will result in a warning that the complex model may harm app performance. If the model is within the performance requirements, this tab can be skipped.
NOTE: Coloring should be applied before simplification. Coloring the model after simplification will require to repeat the simplification process. See Automatic Coloring of Model Targets for more information.
In this example, the model was identified as too complex with 102 parts and 1.311.459 polygons.
- To upload your model for processing, click Start Simplification. Once the model is uploaded, the MTG progresses to the next tab – Optimize Tracking. Since simplification is done asynchronously, it is possible to continue with the configuration of the Model Target in the other tabs, with exception of coloring.
- At any point, you can return to the Complexity tab and see the progress of simplification or Cancel the process.
When simplification is completed, you can inspect the model. The simplification algorithm is optimized for Model Target detection and tracking, preserving edges and contours of the model. Please ensure that the simplified models do not have any gaps or cracks that were not present in the original model. In the panel to the right, you can see the simplified model’s number of parts and polygons.
- It is possible to Undo the Simplification from the Complexity tab. This will delete the simplified model.
The Optimize Tracking tab is to select a tracking optimization mode for your model. Assigning a tracking mode depends on the physical object and on the use case. The possible modes are:
- Default which works well on a majority of model objects.
- Low Feature Object that can be used for cars and with objects that are reflective, untextured, and have smooth surfaces.
There is also an AR´Controller mode, but it can only be set in the Unity Editor or with the API. For a complete guide, please see Optimizing Model Target Tracking.
- Select the tracking mode best suited for your model type and use case. In this example, we select DEFAULT that has proven to work well with 3D printed and matte objects.
Guide Views are essential when it comes to initiate tracking of a Model Target. You can choose between Guide Views and Advanced Views. Mixed Guide View types is not supported.
Guide Views are presented as a rendered outline of your model that, during the AR session, users will match with the object to initiate the AR experience.
Advanced Views are recognition ranges that automatically activate the AR experience when the model is detected from any defined angle. Selecting the Advanced view will require the model to be trained in the cloud. If you wish to create Advanced Views please refer to Advanced Views.
We select in our example Create Guide View.
- Before moving on with the Guide View, a field of view should be defined according to how the users would handle the device. Choose between the Digital Eyewear, Landscape, or Portrait. This setting can also be selected from the three icons in the right corner of the 3D view pane. Depending on your selection, the dotted line in the 3D view pane adjusts the screen rendering area of the app.
- Click Next Step.
- Now, we need to adjust the view with the tools in the upper left corner of the 3D view pane. The view and dotted frame should be adjusted to a position we would like the users to match with to start the tracking of the Model Target. Once adjusted, the Create Guide View will generate a Guide View from that exact position and distance.
TIP: Your mouse can also be used to change the position.
The right column provides with guides on the best practice of creating a Guide View.
- In the following step, and depending on the type of Guide View that you have created, you will find three icons;
- Rename the Guide View e.g., front, back, above, below, close-up etc..
- The Model is now ready, and the Progress Meter confirms that we have attended to all the tabs and configurations available to us. Click the Generate Model Target. This will take us back to the Home Screen.
Generating Model Targets
When you click Generate Model Target, a dialog opens that displays the number of remaining targets on your developer account as well as the Guide Views and directory where the Model Target database is saved. The Guide Views are saved as PNGs and the Model Target as .vup project file.
NOTE: The Guide View images can be replaced with custom images instead of the Vuforia Engine provided default images.
Every Model Target generated counts against your target quota. Re-generation of the same model with a different Guide View also counts as new. Additionally, every training session counts against the training quota, which is separate. For specific quota options associated with any license, refer to the pricing page.
Managing Model Targets
- In the Home Screen, click the menu (...) icon and select Open Destination Folder.
The destination of the generated Model Target database opens in the project folder.
You can now load the Model Target database into your Unity or Native project environment or download the Model Target Test App to test the tracking capabilities of your Model Target.
If you wish to create Advanced Model Targets, refer to the Advanced Model Target Databases article.