Camera FarClip set to 1000 on XR start

Hi - I’m trying to develop an app for the Vision Pro using Earthatile (GitHub - playcanvas/earthatile: Engine-agnostic runtime for 3D Tiles geospatial datasets), and everything seems to be working fine, except the far clip of my scene keeps getting set to 1000 when entering VR (I have the camera far clip set to 10,000 in the editor).

I’ve tried forcing it on / after XR start, but that doesn’t seem to work either - e.g.:

Doing this when I try to start the session:

    // start session
    this.cameraEntity.camera.farClip = 10000;
    this.cameraEntity.camera.startXr(pc.XRTYPE_VR, pc.XRSPACE_LOCALFLOOR);

And even doing this:

Vr.prototype.onStart = function () {
    this.checkButton(true);
    console.error('XR Started: ' + this.app.xr.camera.camera.farClip); // reports 1000
    this.app.xr.camera.camera.farClip = 10000;
    console.error('Updated far clip: ' + this.app.xr.camera.camera.farClip); // still reports 1000
};

Any ideas what might be going wrong? I need it to be 10000, as the app allows the user to fly around in 3D tiles in VR, which means the horizon would ideally be quite far away.

Have you tried changing it directly from the camera settings?

In the editor, you mean? Yes; it’s set to 10,000 here:

Then it should work properly. What is the need for the code?

Mostly because it doesn’t work properly :slightly_smiling_face:

Essentially - it works when I preview the experience in the browser (and interestingly in an XR emulator), but as soon as I fire up the VR experience in the Vision Pro, the farClip reduces substantially.

I have to split this into two separate posts:

e.g. Here’s the view in the regular browser (on the Vision pro emulator):

And here’s the view when I enter XR:

You can see that the 3D tiles data gets substantially clipped in the XR experience. So I put the code in to A) try to debug what was going on (that’s how I’m seeing that the farClip in the XR camera is reporting as 1,000) and B) to try to force-fix it.

@moka - have you seen this behaviour before?

WebXR API forces camera near/far clips on the camera, so you cannot change them. This is sort of in a hands of implementation (Apple Vision Pro in this case).
So you have to try to take their far clip into the consideration, and design content with that in mind.

Apple Vision Pro thinks you have to see only 1 kilometer in the distance :frowning:

3 Likes

Ah ok - that’d explain it. I guess I could make the scale of the tiles adjust when I increase the altitude. Will give that a go. Thanks!