2

I have a problem and wonder if someone could help... I have a reaction-diffusion simulation shader (calculated on a compute shader) and I wanted to try it in VR, in a browser... so, based on https://threejs.org/examples/?q=vr#webxr_vr_ballshooter (to enter VR) and https://threejs.org/examples/webgl_gpgpu_birds.html (for the compute), I have written a little application using my texture and calculating it on the shaders.

Strange result: The shader is working and I can enter the VR. But the texture is unstable when I enter VR: it turns black when watching in some angles. No problem moving the camera when not in VR, the texture is consistent, but it can suddenly turn black when in VR. I have reduced the application/shader calculations to a bare minimum as a test, but the result is the same: the texture turns black on some angle when in VR and calculated on GPGPU...

I use Firefox + WebXR API Emulator (extension to test VR apps without headset) but the problem is the same on Chrome and/or with an Oculus.

You can try the test application here: https://nicofolio.bitbucket.io/06_rd_VR_vrBug_simplified/ just rotate the headset (look up) 10 degres or move it forward a little to see the texture turning black. Let me know if you have an idea how to fix the problem! I'll end up checking the webXR libraries to find out how they deal with the camera, but maybe someone can help/know about such issue (and would save me hours of tinkering around)...

Cheers!

nicovernio
  • 21
  • 1

1 Answers1

1

You should disable xr before compute :

  const xrEnabled = renderer.xr.enabled
  renderer.xr.enabled = false
  gpu.compute()
  renderer.xr.enabled = xrEnabled
soju
  • 25,111
  • 3
  • 68
  • 70