# Model Recognition

{% hint style="info" %}
This is a **Work in Progress Article** based on materials available on the [Vuforia Library](https://library.vuforia.com/content/vuforia-library/en/features/objects/model-targets.html).
{% endhint %}

## Model Targets

![Introduction to Model Targets in Unity (Source: Vuforia Library)](https://library.vuforia.com/content/dam/vuforia-library/articles/solution/unity-model-target/mt_gif_02-optimized.gif)

**Model Targets** utilise **3D model data** of an object (for example a 3D Scan or Digital Model).&#x20;

Model Targets enable applications to **track physical objects** by using this digital data as reference information. Model targets can include rigid and opaque objects of different scales, from **Architectual Landmarks** to **Small Figurines.**

### Requirements: Model Data

In order to create a **Model Target**, 3D model data must first be created. **3D CAD models** and **3D Scans** are suitable data sources.&#x20;

Students at MSD can [learn more about Digital Reproduction](https://ms-kb.msd.unimelb.edu.au/next-lab/3d-scanning/digital-reconstruction-at-the-next-lab) on the **Knowledge Base** and can **access** **training and equipment loans** using [SimplyBookMe](https://msdunimelb.simplybook.me/v2/#book/location/2/).

The **Model Target** itself must be a **rigid object** which **does not contain** transparent or shiny surfaces. The object must also **remain in a fixed location**.

See: [Model Targets Supported Objects & CAD Model Best Practices (Vuforia Library)](https://library.vuforia.com/content/vuforia-library/en/articles/Solution/model-targets-supported-objects.html)

## Creating Model Targets

**Model Targets** are created using the [**Model Target Generator**](https://developer.vuforia.com/downloads/tool). This software converts a **3D model** in to a **Vuforia Engine dataset**. This software is **only available on Windows**.

![Figure 1.0 - Vuforia Model Target Generator ](https://1820679795-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXautSvCbUco5Lv7YrH%2F-LYeLrrjTKINimHaO1J1%2F-LYeMJDVJSIkmkto_SEX%2Fimage.png?alt=media\&token=1a40c4b9-e7bd-429c-a628-ef39b7ae1225)

**The Model Target Generator** software will grade quality or suitability of the mesh, and allow a user to add **"Guide Views"** . This Guide View is an **outline** of a 3D model from a **particular perspective**.

From the **Model Target Generator,** you can export your Model Target **dataset** as a `.unitypackage`.

**Import** the `.unitypackage` in to your **Unity Project**.

## Using Model Targets in Unity

**Model Targets** can be added in to a **Unity Scene** as `GameObjects`.&#x20;

`GameObject > Vuforia Engine > Model Targets > Model Target`

Add an ARCamera to the Environment and enter an appropriate license key. [Read more here](https://ms-kb.msd.unimelb.edu.au/next-lab/augmented-reality/guides/unity-and-vuforia-1/vuforia-primer/..#1-0-the-ar-camera).

**Select** the `ModelTarget` from the **Hierarchy Window**, and designate it a `child` of the `ARCamera`.

**Ensure** that the **Model Target Behaviour scripts** are correct:\
`Inspector Window > Model Target Behaviour (Script)`

* The `Database` and `Model Target` fields should match that of the **recently imported database**&#x20;
* The `Physical Length`, `Physical Width` and `Physical Height` fields should **match** the **physical dimensions** of the **real-world** **object** that the **project references**.
* The `Guide View Mode` field should be set to `Guide View 2D`

**Debug the application**, and verify that when the **Guide View** aligns with the **physical object**, the guide view lines disappear.

When this occurs, the application is **tracking** the **physical object**.

## Adding Content to the ModelTarget

**Content**, such as a **rendered 3d model** or **annotations** can be **rendered** upon the application **tracking the object**.

Add any asset or **GameObject** to the **hierarchy window** and designate it a **child** of the **ModelTarget.**

## Other Resources

[Model Targets](https://library.vuforia.com/content/vuforia-library/en/features/objects/model-targets.html) (Vuforia Library)

{% embed url="<https://library.vuforia.com/content/vuforia-library/en/features/objects/model-targets.html>" %}

[Vuforia Model Target Generator](https://developer.vuforia.com/downloads/tool) (Vuforia Developer Portal)

{% embed url="<https://developer.vuforia.com/downloads/tool>" %}

[An Introduction to Model Targets in Unity](https://library.vuforia.com/content/vuforia-library/en/articles/Solution/introduction-model-targets-unity.html) (Vuforia Developer Library)

{% embed url="<https://library.vuforia.com/content/vuforia-library/en/articles/Solution/introduction-model-targets-unity.html>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ms-kb.msd.unimelb.edu.au/next-lab/augmented-reality/guides/unity-and-vuforia-1/vuforia-primer/model-recognition.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
