Skip to content

Show pins and 3D labels in the Quest app; fix the display modes, Space Setup capture and glTF export - #30

Merged
mrhegemon merged 7 commits into
mainfrom
fix/scan-labels
Nov 14, 2026
Merged

mrhegemon merged 7 commits into
mainfrom
fix/scan-labels

Conversation

@mrhegemon

Copy link
Copy Markdown
Member

Summary

The Quest app showed no pins and no 3D labels. The capture scene's SpatialPinManager and LabelRenderer both pointed at SpatialLabel.prefab, which a862495 deleted with the rest of the legacy sample. So neither created anything, and nothing failed. The LabelRenderer also had no label root, and without one it drew nothing, so it had never drawn a label in this scene, even before a862495.

The same path had five more problems:

  • Pins did not persist. A capture removed the pins of every capture taken more than 6 s before it, though the README said they persist.
  • The boxes mode stopped the app. The trigger's boxes mode switched off the object that also runs capture, so the first press stopped capture and every button.
  • Space Setup blocked capture. With Space Setup done, every capture threw in its Space Setup step and never reached the vision server.
  • Y wrote no glTF. Only the snapshot images reached the disk.
  • The 2D boxes never showed on the camera preview.

This branch fixes all six, with new first-party pin and label prefabs. It also adds a test that fails on any unresolved reference in the build scene, so a deleted asset cannot empty the room silently again.

  • Seven commits on main @ f17ac17. The vision server is unchanged.
  • Nothing was tried on a headset. The checks were Editor tests, Editor screenshots and a debug APK.
  • Two choices are left for the owner (see Owner decisions):
    • the default Florence preset still places no vision-server pins or boxes;
    • nothing in the app clears pins, so they can pile up.

What changed

Pins and 3D labels show again (aeb36f3)

  • New prefabs. Assets/CompanionScan/Prefabs/SpatialPin.prefab is a dot on the object with a stem. SpatialLabel.prefab is the label on a dark plate above it. They are made in this repository from Unity's built-in sphere, cylinder and quad meshes, URP Unlit materials and TextMesh Pro's Liberation Sans.
    • SpatialLabelView turns a label about the vertical axis to face the viewer, keeps it upright, fits the plate to the text and shortens labels longer than 48 characters.
    • Neither prefab has a collider, so a later capture's raycast cannot land on an earlier pin or label.
    • The legacy prefab was not restored. It came with the initial commit's XR-AI-Florence2 sample with no recorded source or licence, and it needed its deleted scripts, animator controller and font too.
  • A label root. The scene now gives LabelRenderer a label root, and LabelRenderer falls back to its own object when none is set.
  • One label per pin. LabelRenderer now follows the pin manager (SpatialPinManager.PinsChanged). Every pin gets one label, Space Setup pins included. The label moves with its pin and goes when the pin is removed. The pipeline connects the two if the scene does not.
    • Before, the pipeline re-rendered every vision-server pin after each capture. With a prefab and a label root, that would have put another copy of every label in the room each time, and the copies would never have moved.
  • Pins persist across captures. SpatialPinManager.enablePinLifecycle is now off by default and in the scene. When on, it drops pins more than 6 s older than a new one. It was on in the scene, so a capture removed the pins of any capture taken more than 6 s before it.
    • A pin now stays where it was placed until a newer pin of the same object updates it.
      • A newer reading of the same Space Setup anchor replaces the pin.
      • A pin on the same track moves the existing pin toward the new hit, and the pin keeps its label. So does a pin with the same Meta label within 15 cm; for unmapped classes, that means the same detector label.
    • ClearPins removes pins, but nothing in the app calls it yet (see Owner decisions).
    • Two different Space Setup anchors never merge. Two unmapped objects with different labels never merge either.
    • ClearPins(source) no longer lets pins and their objects fall out of step. A pin with no object left its slot behind, so later pins lined up with the wrong objects.
  • Smoothing per object. Positions were smoothed per Meta label, and every class without one maps to OTHER, so a chair, a cup and a book were pulled toward each other. They are now smoothed per track:
    • unmapped classes are tracked by their own label;
    • two detections in one capture never share a track.
  • Scene.
    • The pin and label roots sit outside the export root, so pins and labels are not written into the glTF as geometry.
    • The legacy LoadingIcon (missing script and texture) is gone. So is a reference to a lighting settings asset that was never committed.
  • BuildSceneTests (EditMode, 11 tests: 8 here, 1 in 8d43899, 2 in 4792bda) open the build scene.
    • They fail on any unresolved asset reference, missing script or missing object reference.
    • They also check:
      • the pin and label wiring, and that pins persist;
      • the tracking space;
      • the exporter's wiring, and that exports stay on the headset.
    • With the old scene, nine of the 11 failed.

The display modes only show or hide (1557d47)

  • What broke. The trigger cycles boxes, labels and both, starting from both. The boxes mode deactivated the GameObjects of the label renderer and the pin manager.

    • In the shipped scene that is the CompanionScan object. It also holds the pipeline, the camera provider and the exporter, with the controller input on a child.
    • So the first trigger press stopped capture and every button, the trigger that would switch back included.
    • The labels mode switched the same object off and on, and never hid the camera preview.
  • The fix. BBoxRenderer.Visible switches the preview's canvas. LabelRenderer.Visible and SpatialPinManager.PinsVisible switch the label and pin objects.

    • Boxes are still drawn while hidden, so the preview's boxes always belong to its frame.
  • 2D boxes. They never showed:

    • copies of the runtime box stayed inactive;
    • they were placed from the container's centre instead of its corner;
    • their outline took the fill's 5% alpha.

    They are now drawn with solid edges and the detection's label.

Space Setup no longer stops a capture (8d43899)

  • What broke. MetaSceneCollector.trackingSpace was empty in the scene, and OVRLocatable.TrackingSpacePose.ComputeWorldPosition throws without one. With Space Setup done, every capture threw in its Space Setup step and never reached the vision server. No snapshot was sent and no pin was placed, from either source.
  • The fix. The scene now names the camera rig's TrackingSpace. Without one, the collector uses the OVRCameraRig's, else it takes the poses as world poses.
  • A failed read no longer stops a capture. It is logged, and the capture goes on to the vision server.

Y writes the glTF export (4792bda)

  • What broke. The exporter looked UnityGLTF up by reflection. It expected a GLTFSceneExporter(Transform[]) constructor and a two-parameter SaveGLTFandBin, and UnityGLTF 2.20 has neither. So no glTF was ever written.
  • Direct calls. The exporter now calls UnityGLTF directly (CompanionScan.asmdef references UnityGLTFScripts), so a signature change fails the build instead.
  • Wiring. In the scene, the exporter had no pin manager, boundary provider, Space Setup reader or snapshot store.
    • At run time the controller menu made a snapshot store and gave it to both the pipeline and the exporter, which is why the snapshot images were written. The other three stayed empty.
    • The exporter also had no floor or scene-mesh material, and without one UnityGLTF leaves that mesh out.
    • All of these are wired in the scene now, with new FloorPlan.mat and SceneMesh.mat.
    • A BoundaryProvider and a SnapshotFrameStore now sit on the capture object. The exporter uses both, and it shares the snapshot store with the pipeline.
  • What an export holds. The pins, the floor plan, the Space Setup data, and the snapshots with their camera poses.
    • That is what the README's Y row already says.
    • The Companion Scan privacy policy says the same, but it is not on ci.computer yet.
    • A failed Space Setup read no longer stops an export.
  • Exports stay on the headset. uploadAfterExport stays off, and the scene still has no GltfSyncClient, as the camera notice promises. BuildSceneTests checks both.

Docs (454b4fd, c4f652e, cf7e68a)

  • README.md:

    • what a pin and its label look like;
    • that a newer detection of the same object updates its pin, and that pins last until the app is closed, because nothing in the app clears them (age pruning is off);
    • that the display modes keep capture and every button working;
    • that the Florence preset places no pins.
  • docs/quest-capture-gltf.md: the pin update rules, LabelRenderer and SpatialLabelView, and the scene wiring.

  • docs/scan-export-pipeline.md and docs/spatial-capture-architecture.md:

    • a newer pin of the same object updates its pin;
    • pins last until the app is closed;
    • age pruning is off.

    The architecture page also says pins are smoothed per object.

  • cf7e68a corrects 454b4fd, which said in all four places that pins stay until they are cleared. Nothing in the app clears them.

    • It also corrects a line in docs/quest-capture-gltf.md that said the display modes never switch off a GameObject. They switch the pin and label objects, but never the object that runs capture.
  • THIRD_PARTY.md (row added in aeb36f3, reworded in c4f652e): a row for the deleted legacy prefab and the files it used, and the new first-party prefabs that replace it.

    • The prefab, its scripts, animator controller, Roboto font asset and material have no recorded source or licence. Neither does the ConstantRotation script.
    • For loading.png, the sample's deleted License/License.txt recorded only a Flaticon icon page, with no licence terms.

Verification

Run with Unity 6000.6.9f1 on Windows, in batch mode. The last commit, cf7e68a, changes only the README and three docs pages. No Unity test or build step reads them.

  • EditMode: 189 of 189 passed (main: 178), at c4f652e.

  • PlayMode: 67 tests: 42 passed, 24 skipped, 1 failed (main: 43 tests, 18 passed).

    • It ran at 454b4fd. The two commits after it change only THIRD_PARTY.md and Markdown docs.
    • 22 skipped tests need a live vision server (CompanionScan_TEST_SERVER_URL), which was not set.
    • The other 2 skips need a baseline screenshot and the Meta XR simulator.
    • The failure is the known batch-mode one, XrSceneScreenshotTests.QaXrScene_CapturesControllersAndAnchors. Fix the Quest launch blockers: app label, permissions, camera notice and licences #28 had the same failure and the same 24 skips.
  • New tests:

    • SpatialPinManagerTests:
      • earlier captures' pins stay;
      • a newer detection of the same object updates its pin, and a newer reading of the same anchor replaces it;
      • unmapped objects stay apart;
      • ClearPins (all, and by source), PinsChanged and PinsVisible.
    • LabelRendererTests:
      • one label per pin, Space Setup pins included;
      • a label moves with its pin;
      • labels do not pile up over repeated captures;
      • clearing pins takes their labels;
      • hiding and showing, the pipeline's connection, free-standing labels, facing the viewer, and shortened labels.
    • CvPinPlacementTests:
      • unmapped objects are pinned where each was detected;
      • two objects in one capture keep two pins;
      • the same object in the next capture updates its pin.
    • ControllerMenuUiStateTests:
      • the trigger cycles the modes;
      • each mode shows boxes, labels or both without switching off capture;
      • a preview panel made while boxes are hidden starts hidden;
      • these replace CycleDisplayMode_TogglesRenderersAndPins, which asserted the old behaviour: the boxes mode switched off the objects holding the label renderer and the pin manager.
    • BBoxRendererAutoCreateTests: each box is drawn over its object, with its label.
    • SpatialMapExporterTests: in the Editor, an export writes a glTF with the pins, the floor plan and the snapshots.
  • Editor screenshots (not attached): a temporary PlayMode test, not committed, staged a capture in the Editor.

    • Setup: it built a room of primitive shapes. It sent a made-up detection of five objects straight to the box and pin steps, bypassing the vision server and the model preset. It also added two Space Setup pins, for a wall and the floor, straight to the pin manager.
    • Display modes: the both mode showed boxes, pins and labels. The boxes mode showed only boxes, and the labels mode only pins and labels. Capture stayed on in the boxes mode.
    • A second pass of the same detection, a few frames later, left 7 pins and 7 labels.
    • These are Editor renders. They are not the shipped scene and not a headset.
  • Debug-key APK, built at 454b4fd with CommandLineBuild.BuildAndroidQuest and read with aapt2. Its package, version, target SDK, label and permissions are the same as the Fix the Quest launch blockers: app label, permissions, camera notice and licences #28 build:

    • package com.CompanionIntelligence.CompanionCapture;
    • versionCode 1000, versionName 0.1.0, targetSdkVersion 34;
    • label "Companion Scan";
    • no new permissions.

    The build log was not kept.

Not verified

  • Nothing ran on a headset. Not checked on a Quest 3 or 3S:
    • pins and labels on real Space Setup anchors and real surfaces, and whether they are readable at their size;
    • a full capture against the vision server with Space Setup done, which is the case 8d43899 fixes;
    • the display modes with the controllers;
    • an export on the device to files/exports.
  • Space Setup, even in the Editor. No test that ran reads Space Setup. The one that does needs the Meta XR simulator, and it was skipped.
    • For 8d43899, BuildSceneTests checks only that the saved scene names the tracking space.
    • The fallbacks never ran, and neither did a failed read in a capture or an export.
    • The export test gives the exporter no Space Setup reader.
    • The screenshot test added its two Space Setup pins straight to the pin manager.
  • The shipped scene never ran. No test plays CompanionCapture.unity, in the Editor or on a headset. BuildSceneTests only reads the saved scene, and the PlayMode tests and the screenshot test build their own objects.
  • The live-server tests. The 22 live-server PlayMode tests were skipped.
  • Pile-up. Captures taken more than 2.5 s apart are untested; see Owner decisions.
    • CvPinPlacementTests runs both of its captures in the same frame.
    • The screenshot test took its second pass a few frames after the first, from the same spot.
    • No test that ran takes a whole capture, so the removed label re-render shows only in the diff.
  • GitHub Actions. Nothing has run there yet.

Owner decisions

Neither blocks this merge.

  1. The default preset places no vision-server pins or boxes.
    • Why: the controller menu starts on the Florence preset. It applies the preset when the menu is enabled and before every capture.
    • What Florence runs: neither GDino nor SAM2, and only those steps add pins or draw 2D boxes. Florence's object detection is used only for its list of labels.
    • Effect: until the user presses B to change preset, a capture shows only Space Setup labels such as WALL_FACE and FLOOR. Without Space Setup it shows no pins or labels at all.
    • Not saved: the choice is not kept, so every launch starts on Florence again.
    • This predates the branch. The README now says that the Florence preset places no pins.
    • Choose before launch: start on the GDino preset, or have the Florence preset pin and draw its own detections. Then update the README's Display Modes section.
  2. Nothing clears pins, so they can pile up.
    • Why: with age pruning off, a pin stays until a newer pin of the same object updates it. A track expires 2.5 s after it was last seen (trackMaxAgeSeconds).
    • Effect: in a capture taken later than that, a vision-server pin is updated only by a hit within 15 cm with the same label. A large object seen from another spot can collect duplicate pins and labels, which stay until the app is closed.
    • Docs: the README and docs say that pins last until the app is closed (cf7e68a).
    • Options: add a clear-pins control, for example in Settings, or match same-label pins across captures more loosely. If a control is added, document it in the README and update the three docs pages that say nothing clears pins.
    • Either way, check for pile-up on a headset.

Merge notes

🤖 Generated with Claude Code

mrhegemon and others added 7 commits November 13, 2026 22:06
The capture scene pointed SpatialPinManager.pinPrefab and
LabelRenderer.labelPrefab at SpatialLabel.prefab, which a862495 deleted with
the rest of the legacy sample (its message names only the NaughtyAttributes
demo). No asset carries that GUID any more, so neither spawned anything: no pin
and no 3D label ever showed, for vision server or Space Setup pins.
LabelRenderer also had no labelRoot, so it returned early even with a prefab.

- New first-party SpatialPin and SpatialLabel prefabs, made here from Unity's
  sphere, cylinder and quad meshes, URP Unlit materials and TextMesh Pro's
  Liberation Sans: a dot on the object with a stem, and the label on a dark
  plate above it, turned to face the viewer (SpatialLabelView). The legacy
  prefab was not restored: it came with the XR-AI-Florence2 sample with no
  recorded source or licence, and needed its deleted scripts, animator and
  font too.
- LabelRenderer follows the pin manager: one label per pin, Space Setup pins
  included, moved with its pin and removed with it. The pipeline no longer
  re-renders every vision server pin after each capture, which stacked another
  copy of each label in the room every time.
- Pins persist across captures, as the README says. Age pruning (6 s) is off by
  default and in the scene: before, each capture removed every earlier pin. A
  pin now stays until cleared or replaced by a newer pin of the same object
  (same track, same Space Setup anchor, or the same label nearby).
  ClearPins(source) no longer lets pins and their objects fall out of step.
- Positions are smoothed along each object's track, not per Meta label: every
  class without one is OTHER, so a chair, a cup and a book were pulled toward
  each other. Two objects in one capture never share a track.
- The scene gets pin and label roots outside the export root, and loses the
  legacy LoadingIcon (missing script and texture) and a reference to a
  lighting settings asset that was never committed.
- BuildSceneTests fails on any unresolved reference in the build scene, so a
  deleted prefab cannot empty the room silently again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The trigger's boxes mode deactivated the GameObjects of the label renderer and
the pin manager. In the shipped scene that is the CompanionScan object, which
also holds the pipeline, the camera provider and the exporter, with the
controller input on a child: the first trigger press from the default mode
stopped capture and every button, the trigger that would switch back included.
The labels mode switched the same object off and on, and never hid the camera
preview, which hangs from the controller.

The modes now only show and hide: BBoxRenderer.Visible switches the preview's
canvas, LabelRenderer.Visible and SpatialPinManager.PinsVisible the label and
pin objects. Boxes keep being drawn while hidden, so the preview's boxes always
belong to its frame.

The 2D boxes themselves never showed: copies of the runtime box stayed
inactive, were placed from the container's centre instead of its corner, and
their outline took the fill's 5% alpha. They are drawn now, with solid edges
and the detection's label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MetaSceneCollector.trackingSpace was empty in the scene, and
OVRLocatable.TrackingSpacePose.ComputeWorldPosition throws without one. With
Space Setup done, every capture threw in its Space Setup step and never reached
the vision server: no snapshot was sent and no pin was placed, from either
source.

The scene now names the rig's TrackingSpace. Without one, the collector uses
the OVRCameraRig's, else takes the poses as world poses, and a failed Space
Setup read is logged while the capture goes on to the vision server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e data

Y wrote no glTF at all. The exporter looked UnityGLTF up by reflection with a
GLTFSceneExporter(Transform[]) constructor and a two-parameter SaveGLTFandBin;
UnityGLTF 2.20 has neither, so only the snapshot images reached the disk. The
exporter now calls UnityGLTF directly (CompanionScan references
UnityGLTFScripts), so a signature change fails the build instead.

The scene's exporter also had no pin manager, boundary provider, Space Setup
reader or snapshot store (the controller menu added only the store at run
time), and no floor or scene mesh material, without which UnityGLTF leaves a
mesh out. They are wired now, with a BoundaryProvider and a SnapshotFrameStore
on the capture object that the pipeline shares, so an export holds the pins,
the floor plan, the Space Setup data and the snapshots with their camera poses,
as the README says. A failed Space Setup read no longer stops an export.

Exports stay on the headset: uploadAfterExport stays off and the scene still
has no GltfSyncClient, as the camera notice promises.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: what a pin and its label look like, that they persist until
  replaced by a newer pin of the same object (age pruning off), that the
  display modes keep capture and the buttons working, and that the Florence
  preset places no pins.
- quest-capture-gltf: the pin update rules, LabelRenderer and SpatialLabelView,
  and the scene wiring the build scene now has (prefabs, roots outside the
  export root, tracking space, snapshot store, export materials).
- scan-export-pipeline, spatial-capture-architecture: pins are smoothed per
  object and kept until replaced, not pruned by age.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The removed-assets row said none of the legacy files deleted in a862495 had
a recorded source or licence. The sample's License/License.txt, deleted in
the same commit, did name a source for loading.png: a Flaticon icon page
(loading_39979), with no licence terms. The prefab, its scripts, animator
controller, Roboto font asset and material, and the ConstantRotation script
have no recorded source or licence.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
454b4fd wrote in the README and three docs pages that a pin stays until
the pins are cleared. Nothing in the app calls SpatialPinManager.ClearPins,
so pins last until the app is closed; the pages now say so. Whether to add
a clear-pins control is left open.

The README also says that a newer detection of the same object updates its
pin, as the docs pages do: only a Space Setup anchor replaces one outright.

docs/quest-capture-gltf.md also said that the display modes never switch
off a GameObject. They switch the pin and label objects; what they never
switch off is the object that runs capture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mrhegemon
mrhegemon merged commit ae09e37 into main Nov 14, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant