RenderTargetTexture not working correctly on Meta Quest 3 (only renders for one eye)

Hi,

I discovered an issue with RenderTargetTexture on the Meta Quest 3. The render-to-texture only works correctly for the left eye, the texture remains empty for the right eye. This only occurs on the device (both via Quest Link and from the on-device browser), it works fine with the WebXR emulator.

Playground:

Steps to reproduce (on Meta Quest 3, have not tested with other headsets):

  • Run the playground
  • Enter VR
  • Close right eye and see a colorful cube, as the texture is correctly filled in the first pass
  • Close left eye and see a dull cube, as the texture stays empty

The issue does not appear to be specific to this code. I was able to reproduce the fact that RenderTargetTexture only works correctly for one eye on the Quest 3 with several examples from the playground by simply adding a WebXR Experience Helper.

cc @RaananW as I am wondering if it could be related to some of the latest layer changes ?

Yes, this is related to a fix in about to push in the xr improvements PR. This is a clearing issue.
I’ll analyze it fully on Monday to be sure.

Any chance for a nightly build once this is fixed, as it currently really limits custom materials on the Quest?

The minute it is fully tested it will be merged. I was out ysterday so I couldn’t finish my tests, but will make it a priority today.
I’ll run a nightly right after

Something has changed in the behavior in 6.43.0, but it’s still not working as expected. Now, in the playground example, nothing is rendered for the right eye:

(previously the texture was empty, hence the cube has a solid color for the right eye)

1 Like

checking that now

Try this - RenderTargetTexture Not Working Correctly on Meta Quest 3 | Babylon.js Playground (babylonjs.com)

The thing is this - custom render target, when running in an XR device, need to be rendered as part of the camera and not the scene’s render loop.

I believe I have an automated solution for this (which is quite straightforward TBH), i’ll test it and add it to the core code. probably with a flag to maintain back-compat, but i’ll device that soon :slight_smile:

Make sure XR rig cameras render scene’s custom render targets by RaananW · Pull Request #14796 · BabylonJS/Babylon.js (github.com)