I’m new to AR and I’m trying the AR Mobile Template (which by the way is severely lacking in documentation).
I’m trying the Tracked Image Manager, I added it to the XR Origin gameobject (in the SampleScene in the Scenes folder), I created a library with a single image in it that I want to detect and track.
But as soon as I press play, the reference to the library in the manager disappears (becomes null), and at the same time, the manager somehow detects the image on a quad, even though it’s not actually there (the quad is just plain black).
The quad is called “Simulated Tracked Image”, so clearly the template here is doing something, but none of this is documented and I don’t understand what exactly is going on.
If anyone can explain what’s going on here, it would be much appreciated.
1 Like
Yes, it behaves this way in the Editor. This is not a bug…
You can check the relevant info in Unity Docs.
XR Simulation (Unity Editor)
- With XR Simulation, can detect and track all simulated tracked images in the Unity Editor, even if you have not included their textures in your reference image library.
.
To optionally bind a simulated tracked image to your reference image library, set the Image field of its Simulated Tracked Image component to reference a texture asset that is also used in the reference image library.
- When XR Simulation detects images that are not part of the reference image library, the corresponding ARTrackedImage trackables will not contain a fully initialized referenceImage. Instead, the guid property of the referenceImage is set to zero, and its texture is set to null.
If you want Multiple Image Tracking, then there are even more specifics when testing in Unity Editor, which I described in My Tutorial.
Image Tracking Templates
There are several updated resources to implement Image Tracking:
- Official Unity Examples for different versions of AR Foundation:
-
-
- My Example with Multiple Data (based on different Tracked Images) for the Only Game Object.
Thanks for the info!
But where does it say that the reference becoming null in the editor is normal?
And it also doesn’t explain why it isn’t working when I build it on a device. (It can’t detect the image in the library)
1 Like
I have started this investigation in April:
Since then, I found no comments that such behavior is not normal.
You can submit a bug report.
Due to the fact, that this is not a crucial factor for me, I didn’t make a report.
I have no idea what you did internally with AR Mobile Template in details to make it work with Image Tracking — you didn’t provide any logs and reference library settings — there are some requirements for images separately for each platform: ARCore/ARKit.
This template is intended for Plane Tracking. It also has docs.
If you want to test ready-made Image Tracking experience — download the free Unity Template mentioned above.
The reference becoming null is normal: com.unity.xr.arfoundation/Runtime/ARFoundation/ARTrackedImageManager.cs at master · needle-mirror/com.unity.xr.arfoundation · GitHub
Failure on device is likely due to insufficient image quality.
On ARCore, you can check image quality with the arcoreimg tool: The arcoreimg tool | ARCore | Google for Developers
On ARKit, you can check image quality settings in Xcode, although Apple still hasn’t restored the video that they deleted which explains how to do it. ARkit Image Tracking quality...
1 Like