How to change scene between two cameras in WebXR?

Hello everyone!
I use Oculus and run babylon’s XR example PG successfully. I read some source codes and find that two cameras( left and right) render scene twice in WebXR mode.
So, I wonder if it’s possible to change the meshes or materials when render for left and right cameras. More precisely, for example, hide a mesh when render for left camera and not hide this mesh when render for right camera.
I know this is really an uncommon question. Thanks first!

cc @RaananW

Very uncommon question! but yes, of course you can. The render process of those cameras is the same as any other camera in babylon. Meaning, you can use the onBeforeCameraRender observable of the scene to check which camera is currently rendering and make the changes that you want.

I wouldn’t recommend rendering different elements for each eye, but this is, of course, your choice :slight_smile:

Cool! Thanks!

1 Like