Pixel-exact selection outlines for RealityKit, as a Metal post-process. Constant pixel width, follows moving entities, supports multi-selection, and never touches your scene. How it works →
.package(url: "https://github.com/elkraneo/PostProcessOutline.git", from: "1.1.2")let outline = OutlineRenderer(cgColor: UIColor.systemYellow.cgColor, radius: 3)
let installation = outline.install(on: arView) // keep alive; replaces arView.renderCallbacks
outline.setSelection(arView.entity(at: point)) // nil clearsFor RealityView, prefer SelectionEffects: the same outline as a component (SelectionEffectComponent), with per-entity colors and no per-frame wiring. To use this package directly:
@State private var effect = PostProcessOutlineEffect(color: .yellow, radius: 3)
RealityView { content in
var attached = false
var later = content
updates = content.subscribe(to: SceneEvents.Update.self) { _ in // every frame
if !attached { // attach on the first frame, not in make or update:
attached = true
later.renderingEffects.customPostProcessing = .effect(effect)
}
effect.setViewMatrix(camera.transformMatrix(relativeTo: nil).inverse)
effect.updateTransforms()
}
}
effect.setSelection(entity)Attach the effect on the first frame. On macOS 27, setting it in the make closure crashed every time, and in update: intermittently; this looks like a RealityKit bug (details and reproduction).
- Call
preloadGeometry(of:)after loading selectable entities. The first mesh read is slow (~100 ms for 46k vertices); selection is ~1 ms after that. For content edited in place (e.g. a live USD stage), setcachesGeometry = false. meshSelectionpicks which meshes in a hierarchy are outlined: everything (default), the nearest meshes, or descendants first (for USD prims carrying aggregate meshes).colorandradius(0…64) can change live.- The outline is X-ray style: it stays visible behind other geometry.
- iOS, macOS and tvOS 26+; not on visionOS. Run-tested on macOS 27; other platforms are build-tested.
See Examples/ for a working app with both versions.
This project is available under the MIT license. See the LICENSE file for more info.

