Cardbord view by WebVR but not WebXR?

My goal was to code an OpenStreetMap 3D Viewer, running on any device:
A) On simple monitors in plain mono
B) On smartphones in stereo to use a Cardboard
C) Om Oculus Quest immersive
What is the best way to do this with BJS?

First I used WebVR and it it was ok:
A) On simple monitors you see that VR logo and gets key and pointer controls
B) On smartphones you touch that logo and gets stereo and orientation controls
C) Om Oculus Quest you “shoot" that logo and gets immersive and full controls

BJS WebVR hase a niche fallback to stereo, even if there is no WebVR supported on the device. :hearts:

Then someone form BJS told me: WebVR is out, use WebXR
and for older devices, use polyfill.
A) On simple monitors you see no VR logo: ok (VR+polyfillXR)
c!) On Oculus Quest you shoot that logo and gets immersive, fine. (XR)
B) On smartphones you touch that logo and gets stereo (nothing+polyfillXR), but:
“The XR experience helper doesn’t have this cardboard-style compensation"
. The fallback to stereo will only work if I use polyfill
. The screen solution is bad in portrait mode (see also this)
. The stereo view is wrong

There is a fine code running via WebVR. Why don’t we use it for WebXR too?

Sure, I could use WebVR on smartphones (if no WebXR is given) to get Cardboard mode.
But the APIs of WebVR and WebXR are quite different.
To code my functions, some code needs to be written twice,
not nice, but the only way I see.
I consider to write a class Device, hiding all the differences.

I need to get/set orientation/position of the camera(body) and device(head)
But that may be a topic for an extra question.

Hi @DerKarlos, I’m not sure there is a good answer for this as the issue seems to be more about the WebXR standard itself. Invoking @RaananW :slight_smile:

You think so?

You assume, this fallback to cardbord is a part of WebVR?
I expected, it is a feature of BJS, activated if no WebVR is given.
(It works well on an iPhone with no WebVR interface.)

In this case, BJS could do it with WebXR too. (polyfill should NOT be used!)
Not any WebXR features of course, just stereo view and orientation controls.
This functions are part of BJS anyway. (as the VRDeviceOrientationFreeCamera)

I may be wrong, I’ll let @RaananW answer you as he is our WebXR expert.

1 Like

Yes, you are right. I think we are mixing WebVR/WebXR and Babylon’s implementation of both.

The WebVR Experience helper had a fallback to VR Device Orientation camera when WebVR is not available. The WebXR experience helper does not do that. Android devices are still supported when using daydream (VR) or immersive-ar sessions.

The WebXR polyfill should be able to support that. The documentation is here - GitHub - immersive-web/webxr-polyfill: Use the WebXR Device API today, providing fallbacks to native WebVR 1.1 and Cardboard . You will need to set the configuration object correctly when initializing it.

Having said that - I would stick to WebXR where WebXR is available, and fallback to the VR Device Orientation camera when not. As we can’t support all of the WebXR features on the cardboard, I try avoiding adding it to the experience helper. If it is all about having the button - I can help you with an example on how to add it when using the orientation camera.

A game or a 3D exebition, created with BJS is by default in mono for monitors. How to simply add Immersion?
With your help, I will try to code a (create)DefaultImmersiveExperienceAsync. :blush:
It should hide and solve all that WebXR/WebVR/Cardboard considerations;
may be even the pollyfill? :thinking:
Yes, the API should be the WebXR interface. :pray:

  • If the device has WebXR (and also WebVR, as in the Firefox Reality on Oculus), nothing special is do to. Using polyfill would/should/will do just nothing! Really?
  • If only WebVR is given (Firefox on Mac…), polyfill should do it. The WebXR API Emulator is only usefull for testing.
  • If non of both is supported, but here are orientation controls, it will be a mobile touch device. That’s the big TODO! :boom:
  • if noting is given, it should be a plain monitor. No VR button is needed.

The big TODO: (you prefeered the first)

  1. WebVR fallback to cardboard could be used, but the WebXR API must be emulated. :worried: It isn’t that much is it?
  2. Using the VRDeviceOrientationFreeCamera also missed the WebXR API.
  3. A proper configured polyfill will do it? I will try it. Actually, I use the default configuration and it seems ok. But - see my the troubles in my initial post above.
  4. You could help me to use the cardboard fallback from WebVR with the WebXR?

The WebXR experience helper does not fallback? If I use polyfill, there is something like this visible on my phone: the VR butten, turn device message, stereo view. Is it done by BJS or polyfill?
There is a solution for the resolution problem, I think.
Could we activate the orientation controls and the wrong stereo?