Several different questions on AR

  • How can I define the position of the camera when I enter into XR mode? I mean when I enter into XR mode I’m always in the 0 0 0 position ideally the user should keep (more or less because the height of the user could change etc) the original relative position to the camera isn’t it?

  • How the floor is defined? the same scene with the same objects sometimes it is placed on the floor correctly, others they are floating, sometimes they looks bigger other some times it looks smaller

  • Following this sample https://playground.babylonjs.com/#NAZYHG#5 I found that in some devices I get: “webxr-polyfill.js:4444 The required feature ‘light-estimation’ is not supported” That’s ok but how can I check that in advance so I can enable/disable it depending on the device?

Btw I’ve tried to check that as this but without luck:

    const availableFeatures = BABYLON.WebXRFeaturesManager.GetAvailableFeatures();
    const indexOfLightEstimation = availableFeatures.indexOf(BABYLON.WebXRFeatureName.LIGHT_ESTIMATION);
    alert(indexOfLightEstimation);
    const availableVersions = BABYLON.WebXRFeaturesManager.GetAvailableVersions(BABYLON.WebXRFeatureName.LIGHT_ESTIMATION);
    alert(availableVersions)

As you can see I’m totally newbie on the AR :sweat_smile: sorry if any of these questions are too naive.

@RaananW is the best of …R stuff :slight_smile:

let’s get started :slight_smile:

  1. When entering VR you are assigned the position of the current camera, excluding position.y which will be populated by the XR system. When entering AR, you are not bound to an entry point. Your enter point is 0,y,0 (let’s ignore Y at the moment), because every time you enter the AR scene in a different position in the real world. What do you expect will happen if you change the camera position in AR? you will not move to a different room. It is possible to change the camera’s position, of course. right after entering XR you can set the camera’s position. In AR it’s not a good practice, at least not until XR will support persistent / permanent anchors, which will allow us to define an entry point.

  2. Floor is defined by the underlying system, depending on the rederence space type you asked. They are all documented here - Geometry and reference spaces in WebXR - Web APIs | MDN . It is recommended to use unbounded in AR.

  3. Certain devices and OS versions support XR in different manner. I am also not 100% sure where the polyfill is coming from, as we are not adding it automatically in the playground. Make sure the WebXR incubation flag is turned on in chrome://flags, especially if you are developing. Just know that some people won’t be able to use some features.

A small note - you can set a certain feature as optional. It is the last optional variable in the enableFeature function.

  1. Not sure what you mean here. You mean after applying the environment? Env in XR works the same as ENV in a standard desktop playground. Do you have the same experience there?

1- OK I understand your point I’ll try to make a workaround.

2 - I tried with unbounded but things (people in my case) were floating I needed them placed on the actual ground.

3 - Great! I think that marking it as optional could do the work, btw polyfill was added by the PC Chrome emulator, it doesn’t support that feature and all my mobile devices have it so it is the only way I’ve found to check what happens if it is not supported.

4- Please test my playground https://playground.babylonjs.com/#NAZYHG#85 my two pink balls (no pun intended!) have different roughness at the beginning but as soon as you get into AR both are super shiny as if they have no roughness at all.

Thank you for your time.

1 Like

Btw I’ve notice that there are no AR support for IOS but using costly third party libraries like Zappar, right? (I hate Apple :unamused:policies)

And abusing your confidence… how could I make it cast shadows on the real ground? I understand that it will not catch the geometry of the real scene but just to make “contact”.

Thank you in advance!

yeah, this is all Apple’s fault. They have decided not to implement webxr for safari, and also decided to force safari to be the only browser on iOS. Fair? no. Good for the web? No. Good for apple? I guess?..
They even gave the community a little bit of hope, adding an experimental flag to enable webxr on iOS 16, and then just removed it in a recent update.

You could use plane detection for that, and apply shadow-only material on them. This way you will case shadows on those detected planes while the planes themselves will not be visible.

@RaananW any thoughts on the roughness issue?

Here is a basic sample: Babylon.js Playground

This is how it looks on non AR where you can see the different roughness clearly

Meanwhile in AR they look almost identical:

Thank you!

sorry, didn’t get a chance to debug this yet. They do look different, but not as they do outside of AR.
Is this with the light estimation turned on? Does it happen with the light estimation turned off?

That’s it without light estimation it works ok.

1 Like

I think that you already guessed it but it seems that the highlights (probably caused by the light itself) are “blurred” but the general map is not.

i’ll work on that during the week

3 Likes

Is there anything that we can test? :drooling_face:

not yet, sorry. will keep you updated here. WebXR is now my priority - a few new features and this issue.

1 Like

Great! if I can help with anything just let me know.

This PR ( [WebXR] Add HDR Filtering to webxr light estimation by RaananW · Pull Request #14526 · BabylonJS/Babylon.js (github.com)) adds hdr filtering to the LE texture. It looks like this:

3 Likes