Repository navigation
fix(ios): render outline traits in XRLiveRealityKitSession - #102
Merged
Merged
Conversation
`userData.xr.outline` shells were only created by `RealityKitHelper.applyXRTraits` -> `configureEntity`, which hosts that drive an `XRLiveRealityKitSession` never call (the iOS demo only calls it when no session can be created). So every outlined node, such as the GripperTarget orb in the Robotic Arm IK preset, rendered with no rim on iOS and visionOS. The session now applies enabled `outline` traits to its bound entities when it binds the scene, matching web, where the post-processing plugin draws outlines whenever the trait is set. It reads the traits through `session.traits(at:)`, like `enablePostProcessing` does for bloom, and does not go through `configureEntity`, so it does not re-add the physics bodies `bindEntities` strips or repeat `installInputTargets` work. Now that sessions carry shells, keep them out of paths that would treat them as scene content: - `recolor` skips shells, so material changes (e.g. cycleMaterialColor) no longer repaint the rim with the model's color. - `bindEntities` skips shells, so re-binding a hierarchy cannot bind a shell as a node's fallback mesh entity. - `installInputTargets` removes the collision that `generateCollisionShapes(recursive: true)` gives shells, so taps hit the model instead of the enlarged rim (and hosts never see a shell as the hit entity). - `XRSimRealityKitBridge.setFlash` and `color(of:)` skip shells, so a hit flash does not swap in a non-culled material that hides the model. Adds `testRealityKitSessionRendersOutlineTraits`, which fails without the `recolor` guard and checks that shells take no collision.
Collaborator
|
Thanks for tracking this down and putting together such a thorough fix and test case, @shaaaaawn! Calling I've approved the GitHub Actions CI run—once the checks finish green, we'll get this merged. |
This was referenced Nov 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
userData.xr.outlinenever renders in RealityKit hosts that drive anXRLiveRealityKitSession. Outline shells are only created byRealityKitHelper.applyXRTraits→configureEntity→applyOutline, and session hosts don't callapplyXRTraits; the iOS demo calls it only when no session can be created. On web,three-live/src/plugins/postprocessing.tsdraws the outline whenever the trait is set.On current
main(9ea5712), the greenGripperTargetorb in the Robotic Arm IK preset (outline: { color: '#22c55e', thickness: 0.025 }) shows no rim in the iOS demo. With this change it does.Change
XRLiveRealityKitSession.bindEntitiescallsRealityKitHelper.applyOutlinefor each bound node whosesession.traits(at:)has an enabledoutline. It goes in node order: compiled GLBs list parents before children, so a child's own outline wins. It doesn't go throughconfigureEntity, which would re-add the physics bodiesbindEntitiesstrips.RealityKitHelper.isOutlineShell):bindEntitiesnever binds a shell as a node.recolorleaves the unlit rim alone on material changes (cycleMaterialColor,setMaterialUniform).installInputTargetsremoves the collision thatgenerateCollisionShapes(recursive: true)gives shells, so taps hit the model instead of the slightly larger rim.XRSimRealityKitBridge.setFlashandcolor(of:)skip shells, so a hit flash can't swap in a material without front-face culling.Validation
9ea5712plus this commit, Xcode 27.2, Swift 6.4.2:swift test(macOS): 111 tests pass. The newtestRealityKitSessionRendersOutlineTraitschecks:cycleMaterialColorselect recolors the orb but not the rim;It fails on unpatched
main("Session must add an outline shell to the outlined node").xcodebuild teston an iPhone 17 Pro simulator (iOS 26.5): pass.xcodebuild teston an Apple Vision Pro simulator (visionOS 27.2): pass, including the outline test, which runs the visionOS code path.iOS demo, XR-Live → Robotic Arm IK: no rim on
main,#22c55erim with this change (below). With a temporaryonSelecton the orb, a tap reportsTapped GripperTarget. Without the collision removal it reportedTapped __xr_outline_shell.visionOS: the same preset in a minimal volumetric
RealityViewapp (not part of this PR) that binds it withXRLiveRealityKitSession. It steps the runtime a fixed 45 frames, so both captures share a pose.Scope
mobile/ioschanges. Web, Android, Rust and the trait schema are unchanged.outlineeither (SceneCoreComponentApplier.onAttachOutlineis a no-op hook).applyOutlinerim is static, sopulseisn't animated, and skinned or blend-shape meshes keep their bind shape.applyOutline's fallback.