Hi, drcmda
I was trying to use mesh reflector material (GitHub - pmndrs/drei: 🥉 useful helpers for react-three-fiber) in webvr, but it makes the entire vr scene into black. Do you have any ideas to make it work properly?
useFrame(() => {
// TODO: As of R3f 7-8 this should be __r3f.parent
const parent =
(materialRef.current as any).parent || (materialRef.current as any)?.__r3f.parent;
if (!parent) return;
parent.visible = false;
const currentXrEnabled = gl.xr.enabled;
const currentShadowAutoUpdate = gl.shadowMap.autoUpdate;
beforeRender();
gl.xr.enabled = false;
gl.shadowMap.autoUpdate = false;
gl.setRenderTarget(fbo1);
gl.state.buffers.depth.setMask(true); // <----- This Line?
if (!gl.autoClear) gl.clear();
gl.render(scene, virtualCamera);
if (hasBlur) blurpass.render(gl, fbo1, fbo2);
gl.xr.enabled = currentXrEnabled;
gl.shadowMap.autoUpdate = currentShadowAutoUpdate;
parent.visible = true;
gl.setRenderTarget(null);
});