Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rooftop anchor disappears beyond ~1000m from user on iOS – Is there a known distance limit? #114

Open
igpad94 opened this issue Feb 17, 2025 · 3 comments

Comments

@igpad94
Copy link

igpad94 commented Feb 17, 2025

Hi guys,

I’m using the ARCore iOS SDK (with the Geospatial API) to place rooftop anchors on buildings that can be up to 1,000–1,100 meters away from the user’s location. While anchors at shorter distances (e.g. 500m–900m) work fine and render properly in AR, any anchor that’s placed around or beyond ~1km from the user does not appear in the AR scene. It’s as if it gets culled or is invisible, even though the anchor creation doesn’t throw an error.

Question: Is there a known maximum distance for rooftop anchors to be rendered when using ARCore on iOS? Or is this limitation caused by ARKit’s camera culling/far-plane limit? If so, do you recommend any workaround (like adjusting the far plane, origin shifting, etc.) on iOS?

Below are more details and a snippet of how I’m creating the rooftop anchor.

Environment
iOS Device: (e.g. iPhone 13 pro, iOS 18.1.1)
ARCore iOS SDK version: (e.g. v1.47.0)
Xcode version: (e.g. 16.2)
RealityKit/ARKit for rendering

Steps to Reproduce

  • Initialize a GARSession with geospatial mode enabled.
  • Obtain user’s location (~0,0 in local space).
  • Call createAnchorOnRooftop for a building coordinate that’s ~1100 meters from the user.
  • Observe that ARCore successfully creates the rooftop anchor (no error).
  • Check the AR scene in RealityKit: the anchor is not visible, even though nearer anchors show up fine.

Expected Behavior:
The rooftop anchor should appear in the AR scene at the correct position, just like anchors <1000m away.

Actual Behavior:
The rooftop anchor does not appear or is immediately culled when the distance is ~1km or more.

// Example of how we’re creating a rooftop anchor:
do {
let futureId = UUID()
pendingFutures[futureId] = try garSession.createAnchorOnRooftop(
coordinate: CLLocationCoordinate2D(latitude: targetLat, longitude: targetLon),
altitudeAboveRooftop: 0,
eastUpSouthQAnchor: eastUpSouthQTarget
) { anchor, rooftopState in
self.pendingFutures.removeValue(forKey: futureId)
guard rooftopState == .success, let anchor else {
// Some error handling
return
}
self.anchors.append(anchor)
self.anchorTypes[anchor.identifier] = .rooftop
}
} catch {
print("Error creating rooftop anchor: (error)")
}

(Let me know if there’s a better place in the SDK to adjust the max view distance or if there’s a recommended pattern for large-scale rendering in ARCore on iOS.)

@15kingben
Copy link

1000 might be the default far view frustum for SceneKit ARView, you can try adjusting that on the camera: https://developer.apple.com/documentation/scenekit/scncamera/zfar

@igpad94
Copy link
Author

igpad94 commented Feb 18, 2025

Yeah i thought about that, but I’m using RealityKit (ARView) instead of SceneKit (ARSCNView), so SCNCamera.zFar isn’t directly applicable. RealityKit doesn’t provide a public API for setting the camera’s far clipping plane. I started building my app based on the ARCore iOS SDK Geospatial example, which uses ARKit with RealityKit. So my only possible solution is to migrate to SceneKit?

@15kingben
Copy link

Ah, you are correct, maybe it is possible to set the camera mode to non-AR, and add a new Perspective Camera which you have control over, http://developer.apple.com/documentation/realitykit/perspectivecamera#overview, and then make that camera automatically follow the ARView session.currentFrame.camera using updates from the frames.

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

No branches or pull requests

2 participants