Object Localization
Object localization finds one physical object (a machine, a control panel, a product) in the camera and anchors AR content to it, instead of to a scanned space. Treedis builds an object map from the object's textured 3D model; the SDK localizes the phone against that map, and every position you supply is in the model's own frame. A label you pin on the model's valve appears on the real valve.
Available from SDK 0.9.0 on iOS, Android and WebXR.
How it works
- Upload the model. In Connected Workers, a 3D model twin (a GLB) is the source. Open the model and start AR localization in its AR section. Treedis renders the model from hundreds of viewpoints around it and publishes an object map under the model's tour ID; processing takes several minutes.
- Localize. Start a session with a model target. The device sends camera frames as for a tour; the server returns the camera's pose relative to the object.
- Show content. Tags and AR objects use the model's frame: Y up, metres, the GLB's own origin and axes (with the placement the model has in its Treedis space). Content stays on the object while the device moves around it.
| Tour target | Model target | |
|---|---|---|
| Localizes against | A scanned space | One object, from its 3D model |
| Content frame | The tour (Showcase, Y up) | The model (Y up, metres) |
| Navigation, floor plan, floor changes | Yes | No |
| Offline packs (iOS, Android) | Yes | No: online only |
| Georeference and tour groups | Yes | No |
| Occlusion mesh | The space's mesh | The model itself, when published |
Model requirements
- Textured. Localization matches the object's visual detail: labels, print, paint, wear. A plain, untextured CAD model of a smooth object is found far less reliably. Photogrammetry and LiDAR scans with real colours work best.
- Metric and rigid. One model unit is one metre, and the object does not deform.
- Asymmetric. An object that looks the same from several sides (a plain box, a cylinder, a sphere) cannot be oriented.
- Static for best results. An object that stays where it is (a machine, a cabinet) is placed once and kept by the device's AR tracking. See A model that moves for objects that are picked up.
Start a model session
The model target takes the tour ID of the object map: in Connected Workers, the model's own tour.
iOS (Swift)
let session = VPSSession(configuration: configuration)
session.attach(to: arView)
session.start(target: .model(id: modelTourID))
session.setContent([
VPSContentItem(id: "valve", position: [0.12, 0.40, -0.05], stem: [0, 0.15, 0],
title: "Valve", card: VPSTagCard(title: "Valve", subtitle: "Turn to OFF before service"))
])
Android (Kotlin)
session.start(VPSTarget.model(modelTourID), VPSLocalizationSettings())
session.setContent(listOf(
VPSContentItem("valve", Vec3(0.12, 0.40, -0.05), "Valve", stem = Vec3(0.0, 0.15, 0.0),
card = VPSTagCard("Valve", "Turn to OFF before service"))
))
WebXR
const session = new VPSSession({
// ...configuration as for a tour
target: VPSTarget.model(modelTourID),
});
session.setContent([
{ id: 'valve', position: { x: 0.12, y: 0.4, z: -0.05 }, stem: { x: 0, y: 0.15, z: 0 }, title: 'Valve',
card: { title: 'Valve', subtitle: 'Turn to OFF before service' } },
]);
VPSTarget.isModel tells a model target apart. With the VPSController, return a model target from your tour adapter's experience (VPSExperience(target: .model(id:))); every command works as for a tour except navigation.
Show what was found
Localization states and events are the same as for a tour, so a host can show a simple status:
| Session state | Suggested status |
|---|---|
| Scanning | "Searching": ask the user to frame the whole object |
| Localized | "Found · 97%": the accepted fix's confidence as a percent |
| Relocalizing | "Lost": the object left the view or the fix was lost |
Each accepted fix carries its confidence (0–1). The controller also reports onLocalizationStatusChanged and onLocalizationResult(success, confidence). A "search again" button is reset() followed by start.
Model outline
With the mesh overlay on (setMeshVisible(true) or the meshOverlay setting), a model target draws the model's edges as thin glowing lines on the object, hidden behind the object itself, so the user sees what was found and how well it lines up. Set VPSLocalizationSettings.meshOverlayColor (iOS UIColor, Android ARGB Int) for a single colour; the default is the Treedis blue-to-pink gradient. Tours keep their height-line overlay. WebXR does not draw the outline.
Tag cards
VPSContentItem.card draws a card with the tag's icon, a bold title and a grey subtitle at the end of the tag's stem; the stem is the leader line to the pinned part. The card keeps a constant on-screen size and is never hidden by the occlusion mesh, while the pin at the part is. Tapping a card is tapping its tag (onTag). Without a card, tags look as before. WebXR shows "title · subtitle" on the tag's label.
Point each stem away from the object's centre (for example 10–20 cm outwards) so cards do not cover the object.
A model that moves
By default an object is placed once, from agreeing fixes, and then kept by the device's AR tracking, which is right for objects that stay put. For an object that people pick up or move, set VPSLocalizationSettings.modelMoves to true: the session keeps localizing back to back, places the object on one confident fix, and moves it to each new one (eased over 150 ms). Two seconds without a fix reports the object as lost. Content follows the object with a delay of one server round trip, so it trails an object while it is being moved and settles when it stops.
Limits
- Online only: a model target has no offline pack, and selecting the on-device engine for it fails.
- One object per session target. To switch objects, start the session with the other model target.
- No navigation, floor plan, georeference or tour group.
- Lighting, reflections and missing texture detail lower recall and confidence; check the confidence before relying on a fix.

