Unity AR 教學 - Model Target Generator

The Model Target Generator converts an existing 3D model into a Vuforia Engine database that can be used by the Vuforia Engine for Model Target tracking. This tool enables you to confirm whether the features of your model will be usable, to set up the initial snapping position, and then export the final database.

Model Target Generator 將現有的 3D 模型轉換為 Vuforia 引擎資料庫,Vuforia 引擎可以使用該資料庫進行模型目標跟蹤。使用此工具可以確認模型的特徵是否可用,設置初始捕捉位置,然後匯出最終資料庫。

The database generated by the MTG includes renderings of the model from the Guide View (detection position), which you can use if you want to create your own custom Guide View images that might be a better match for the visual style of your app than the default Guide View image that the Vuforia Engine API provides.

MTG 生成的資料庫包括來自「Guide View」(檢測位置)的模型呈現,如果要創建自己的自定義指南檢視圖像,這些圖像可能比 Vuforia 引擎 API 提供的預設指南檢視圖像更適合應用的視覺樣式,則可以使用這些圖像。

 

Training Model Target databases

The Model Target Generator lets you define one or multiple Guide Views for each object and it allows you to merge different Model Targets, each with one or more Advanced Views, into a single advanced database. An advanced database is trained with the MTG through a cloud-based deep learning process that allows your app to automatically switch between multiple Model Targets, each with one or multiple Advanced Views with recognition ranges up to 360-degree at runtime.

Model Target Generator 允許您為每個物件定義一個或多個參考檢視,並允許您將不同的模型目標(每個模型目標具有一個或多個高級視圖)合併到單個高級資料庫中。高級資料庫通過基於雲的深度學習過程使用 MTG 進行訓練,該過程允許你的應用在多個模型目標之間自動切換,每個模型目標都有一個或多個高級視圖,在運行時識別範圍可達 360 度。

 

 

安裝 Model Target Generator 應用程式

The MTG is linked to your developer account and is launched by logging in with your developer credentials. For easy access over multiple MTG launches, the credentials can be stored in the Windows credential store or the macOS Keychain by checking the Remember Me box, and the credentials will be removed again when signing out.

MTG 與您的開發者帳戶相關聯,並通過使用您的開發者憑據登錄來啟動。為了在多次 MTG 啟動時輕鬆訪問,可以通過選中「記住我」框將憑據存儲在 Windows 憑據存儲或 macOS 鑰匙串中,並且在註銷時將再次刪除憑據。

Vuforia 下載網頁 [ 連結 ]

開啟下載的 Model Target Generator 安裝程式,並選擇要安裝的目錄,安裝後桌面將會自動出現捷徑。

 

 

模型的需求與準備

The MTG can read a variety of 3D file formats and convert them into Vuforia Engine's internal mesh format.

MTG可以讀取各種3D檔格式,並將其轉換為Vuforia引擎的內部網格格式。

Consequently, any visual error in the model introduced in this conversion process will be displayed in the MTG viewport. Some source model formats can result in wrongly converted models since they are missing mesh information. Therefore, the MTG should be used to check whether the imported model corresponds to the source data. If there are issues, using a different file format may resolve them; if not, the source data may need to be cleaned up.

因此,此轉換過程中引入的模型中的任何視覺錯誤都將顯示在MTG視口中。某些源模型格式可能會導致模型轉換錯誤,因為它們缺少網格資訊。因此,應使用 MTG 來檢查導入的模型是否與源數據相對應。如果存在問題,使用不同的檔格式可能會解決這些問題;否則,可能需要清理源數據。

Vuforia Engine's Model Target Tracking performs best on CAD models which have particular characteristics, such as the corresponding color to the physical object, are low in complexity, and when it follows our other best practices.

Vuforia Engine的模型目標跟蹤在具有特定特徵(例如物理對象的相應顏色)的CAD模型上表現最佳,並且遵循我們的其他最佳實踐。

Model Targets Supported Objects & CAD Model Best Practices [ 連結 ]

 

 

 

Model Target Generator 支援的功能

The import pipeline supports meshes containing:

Multiple sub-meshes 複數子網格

Vertex positions 頂點位置

Vertex normal 頂點法線

Vertex texture coordinates (one set only)

Diffuse solid colors

Diffuse texture colors

Normal maps 法線貼圖

匯入模型提供的資訊若超過上述資訊,則在匯入時將被忽略。

 

 

 

Model Target Generator 支援的檔案格式

Creo View (.pvz)

Collada (.dae)

FBX (.fbx)

IGES (.igs, .iges)

Wavefront (.obj)

STEP (.stp, .step)

STL (.stl, .sla)

VRML (.wrl, .vrml)

glTF 2.0

支援的紋理格式 JPG, PNG, PGM 檔案 ( 32-bit, 24-bit, 8-bit )

 

 

 

Model Preparation

For a detailed overview of recommendations and best practices, see Model Targets Supported Objects & CAD Model Best Practices.

When preparing the 3D model for the MTG, you will need to check that the scale of the digital and the physical object matches. Attempting to track a toy replica with the 3D model of the full-size object can fail in some instances. In order to be sure to get the best tracking quality, the sizes of the models and objects should match. See Best Practices for Scaling Model Targets for more information on this topic.

為 MTG 準備 3D 模型時,您需要檢查數位物件和物理物件的比例是否匹配。在某些情況下,嘗試使用全尺寸物件的 3D 模型跟蹤玩具複製品可能會失敗。為了確保獲得最佳跟蹤品質,模型和物件的大小應匹配。有關此主題的詳細資訊,請參閱縮放模型目標的最佳做法。

If the model has more than 400,000 polygons or more than 20 parts, the model will need to be simplified. The process of simplification consists of reducing the number of polygons needed to represent the object as a mesh. Simplification is required for the computer vision algorithms to run on mobile devices in real-time; polygon reduction does not impact the detection and tracking accuracy, as long as it is not too coarse.

模型若超過 400,000 個 Polygon 或超過 20 個零件,則需要對模型進行簡化,過程包括減少將物件表示為網格所需的多邊形數。計算機視覺演算法需要在行動裝置上即時運行,需要簡化;多邊形縮減不會影響檢測和跟蹤精度,只要不要太粗糙即可。

 

 

 

Modification 修改

In some cases, the 3D model of an object can contain parts that are not on the object being tracked (or not on all instances), such as an optional extra component that you can specify when ordering the object - extra footrests or a passenger seat on a motorbike, for example. Ideally, the 3D model used for tracking should not contain this part.

在某些情況下,物件的 3D 模型可能包含不在被跟蹤物件上(或並非在所有實例上)的部件,例如,您可以在訂購物件時指定的可選額外元件 - 例如,額外的腳踏板或摩托車上的乘客座椅。理想情況下,用於跟蹤的 3D 模型不應包含此零件。

In addition, parts that can easily move from their position in the 3D model (e.g. a steering wheel that can be rotated or adjusted to fit the driver) can interfere with tracking. Removing it from the 3D model can improve tracking quality since it decreases the disparities between the 3D model and the real object.

此外,可以在3D模型中輕鬆移動位置的部件(例如,可以旋轉或調整以適合駕駛員的方向盤)可能會干擾跟蹤。從 3D 模型中刪除它可以提高跟蹤品質,因為它可以減少 3D 模型與真實對象之間的差異。

Internal parts that are usually contained in a CAD model - but cannot be seen from the outside of the object when trying to initialize tracking, shall also be removed. These increase the size of the device database during storage in your app, and the polygon count at run-time to deal with. Remove these to further increase the performance during detecting and tracking a Model Target.

通常包含在CAD模型中的內部零件 - 但在嘗試初始化跟蹤時無法從物體外部看到,也應刪除。這些會增加應用存儲期間設備資料庫的大小,並在運行時處理多邊形計數。刪除這些內容可進一步提高檢測和跟蹤模型目標期間的性能。

簡化或修改模型可以使用 3D 軟體,例如 3dsMax, Maya, Blender, PiXYZ Studio, Simplygon, Umbra3D, MeshLab 等。

 

Model Target Generator 操作介面

The MTG main interface on the Home Screen has two main parts: On the left you will see individual Model Targets that have been imported or created. Double-clicking on any of them will lead to the 3D viewer to manipulate the model and its Guide Views. In the 3D viewer, a range of tabs are available for configuring your Model Target. In the right corner, a progress indicator shows if all options were addressed.

主螢幕上的 MTG 主介面有兩個主要部分:在左側,您將看到已導入或創建的各個模型目標。按兩下其中任何一個都將導致3D查看器操作模型及其引導檢視。在 3D 檢視器中,有一系列選項卡可用於配置模型目標。在右上角,進度指示器顯示是否已解決所有選項。

Back on the Home Screen, the right-side column holds training sets for Advanced Model Targets and lists your configured, running, and finished training sessions. It is here you compose one or more Model Targets into one trained Device Database and export the final results.

返回主屏幕,右側列包含高級模型目標的訓練集,並列出已配置、正在運行和已完成的訓練課程。在這裡,您可以將一個或多個模型目標組合到一個經過訓練的設備資料庫中,並匯出最終結果。

The status bar on top of the Home Screen displays your available quotas to create Model Targets and advanced databases. To begin with, your Vuforia Developer account has a quota of 20 Model Target Generations and 20 training sets for creating Advanced Model Target Databases. Additional quota can be acquired through licensing. Please see the Vuforia Pricing page for more information.

主屏幕頂部的狀態列顯示可用於創建模型目標和高級資料庫的配額。首先,您的 Vuforia 開發人員帳戶具有 20 個模型目標代數和 20 個訓練集的配額,用於創建高級模型目標資料庫。可以通過許可獲得額外的配額。有關詳細資訊,請參閱 Vuforia 定價頁面。

See How to Create a Model Target for a step-by-step guide on creating a new Model Target using the Model Target Generator.

有關使用模型目標生成器創建新模型目標的分步指南,請參閱如何創建模型目標。

 

 

 

使用輸出的檔案

For Unity, you will use the .unitypackage file. Import it into your Unity project and add and configure a ModelTarget GameObject to use it. See the Introduction to Model Targets in Unity for more information.

使用 .unitypackage 匯入 Unity 專案,然後添加和配置模型目標遊戲物件以使用它。有關詳細資訊,請參閱 Unity 中的模型目標簡介。

For an app developed using the Vuforia Engine native SDK, load the .dat and .xml into a Model Target Observer. See Model Targets API Overview for more information.

對於使用 Vuforia 引擎本機 SDK 開發的應用,請將.dat和.xml載入到模型目標觀察器中。有關詳細資訊,請參閱模型目標 API 概述。

Optionally, use the PNG files as a baseline to design custom Guide View images that your app will use to guide users to correctly align the camera with the tracked objects in order to initialize tracking. If used, note that custom Guide Views need to be loaded and packaged separately by the application developer. See the Model Targets API Overview for details.

(可選)使用 PNG 檔作為基線來設計自定義「指南檢視」圖像,你的應用將使用這些圖像來指導使用者將相機與跟蹤物件正確對齊,以便初始化跟蹤。如果使用,請注意,自定義指南檢視需要由應用程式開發人員單獨載入和打包。有關詳細資訊,請參閱模型目標 API 概述。

 

Guide Views

Using the Model Target Generator, it is possible to define one or more Guide Views for a Model Target, and to set the Target Recognition Range for each Guide View. For more information, see Model Target Guide Views and Advanced Views

使用 Model Target Generator 可以為模型目標定義一個或多個參考檢視,併為每個參考視圖設置目標識別範圍。有關更多資訊,請參見模型目標參考視圖和高級視圖

 

 

進階 Model Target 資料庫

If you want to allow your app to automatically recognize different objects without displaying Guide Views, or if you wish to have one or more Model Targets with a recognition range up to 360°, you need to train an Advanced Model Target database.

如果要允許應用在不顯示「引導檢視」的情況下自動識別不同的物件,或者希望具有一個或多個識別範圍高達 360° 的模型目標,則需要訓練高級模型目標資料庫。

This is done by a cloud-based training process from the Model Target Generator desktop tool. See Advanced Model Target Databases for more information.

這是通過 Model Target Generator 桌面工具中的基於雲的訓練過程完成的。有關詳細資訊,請參閱高級模型目標資料庫。

 

 

回前頁