The Zappar Image Tracking Target lets you attach digital content to a physical image as it moves around in the camera view. It's great for putting 3D content onto posters, business cards, flyers, etc.
The Zappar package can detect and track content to a Target Image. Before developing an image tracked project in Unity you must first train an image into a Target Image (
Zappar Image Trainer
To train an image using the Zappar Image Trainer, follow the steps below:
- Open the
Zappar Image Trainerwindow in from the
Editortab in the Zappar Menu entry.
- Add an image to the
Source imagepath field.
- We recommend setting default parameters for the first use of the image trainer but please note that you will need to enable
ZPT Overwriteexplicitly if the file already exists in the
- You can also decide not to include an image preview with your
.zptfile to minimize your build size.
maxHeightrefers to the training model parameters and won't resize your source or preview image. We recommend keeping it unchanged for optimum usage.
- Click Start.
The resulting image will be automatically added to your
If you'd prefer, you can use the ZapWorks CLI tool to generate a target image easily via the following command:
zapworks train myImage.png
The ZapWorks CLI will generate a
.zpt file (i.e. myImage.png.zpt) that should be placed in a folder named
StreamingAssets in the root level of your project.
Please note that you will have to manually drag and drop the
.zpt file into the
StreamingAssets folder, as Unity will not recognize it as a file type that can be imported using "Import New Asset".
You will need to create a
StreamingAssetsfolder inside the main
Assetfolder, if one doesn't already exist.
Image Tracking Target
- Add the Image Tracking Target into your Hierarchy.
- Select on the Zappar Image Tracking Target in the Hierarchy.
- Update the
Targetproperty to the recently trained Target Image (found in the
- Drag and drop digital content on top of the Zappar Image Tracking Target in the Hierarchy.
This content should become a child of the Image Tracking Target and appear tracked to it in the viewport.
On Seen and On Not Seen Events
The Zappar Image Tracking Target triggers events when the physical target image enters and exits the camera view (
On Seen and
On Not Seen, respectively). With these events, you can specify something to happen when either of these events is triggered. For example, showing and hiding content:
Please refer to the Advanced Usage article for further details.