WebXR with iOS in BabylonReactNative

Hi!

I am new to BabylonJS but have been working with AR and VR for a couple of years through Unity and Viro.
I am currently trying out BabylonJS and BabylonReactNative in particular. I want to use it for AR, and read that OpenXR is used to make that happen.
Now, this could be me misunderstanding, I thought that iOS wasn’t supported through that. But the app runs fine on my iOS device.

Then I read that ARCore and ARKit are used for AR in BabylonNative and BabylonReactNative and they’re going to switch over to OpenXR in the future. This all got me very confused since all the classes have the WebXR prefix to them, so I figured it might all just be a webview with BabylonJS running in that.

Now, am I just misunderstanding WebXR and OpenXR here? What powers the AR in BabylonNative and BabylonReactNative? And if it’s indeed currently ARCore and ARKit, is iOS support going to be lost once it’s switched over to OpenXR?

Any clarification would be greatly appreciated!

pinging @ryantrem

Hey @Peter, happy to clear things up here!

Babylon.js in the browser provides an XR (AR/VR) API that is built on top of WebXR. If you want to have XR in a mobile app using Babylon.js, at first you might think you could just host a WebView, but in reality this is not a solution because 1) WebXR is not supported by Safari or the iOS WebView and 2) WebXR is not supported in the Android WebView. There are many reasons to use Babylon Native rather than hosting a WebView, but certainly getting XR support is one of them.

The way Babylon Native enables XR support for mobile apps is effectively to provide its own implementation of WebXR (just like browsers do). We do this today through three separate implementations. One of those implementations is in fact based on OpenXR, but currently this is only used for HoloLens. The other two implementations are based on ARKit and ARCore. While ARKit and ARCore are proprietary APIs bound to iOS and Android (respectively), OpenXR is an API based on open standards. This means that in the future we expect an OpenXR implementation to exist on Android, at which point we may replace our ARCore XR implementation with the OpenXR one to reduce our maintenance burden. Realistically, we don’t expect to see an OpenXR implementation for Apple products as that’s not the Apple way :).

All of that said, we will continue to support iOS, Android, and Windows (HoloLens) with whatever underlying API makes the most sense for each platform. Support for iOS and Android certainly will not be lost.

3 Likes

Hi @ryantrem

Thank you for taking the time to explain this, I’d figured you weren’t using a WebView, but the naming of all the components starting with WebXR made me confused.
Your explanation makes a lot of sense.