Hello,
I’m using three.js for webxr (via react-three/xr) on Vision Pro. I would like to render a different mesh for each eye and I can see that layers are meant for that purpose and it “kind of” works.
Both meshes have set layers=1
and layers=2
. During the render, layers.mask
values are correctly set to 3 and 5. The issue is with a subsequent updateCamera() that sets all masks to the union of all 3 objects (ArrayCamera container and both left and right cameras).
My current hotfix is to reset gl.xr.getCamera().layers.mask = 1;
on every tick but it seems like a bug that I need to do that and any set mask for XR cameras is overridden automatically.
It worked correctly on v169 but after this MR WebXRManager: Inherit active layers from camera by mrxz · Pull Request #29742 · mrdoob/three.js · GitHub it has the issue. The introduced change of modifying a mask on cameras outside the scope of updateCamera()
function without checking what argument is being dealt with seems like a bug.
Codesandbox for this: https://codesandbox.io/p/sandbox/k89xm9