Scene.environment hdr lost during web XR

_G.MYTHREE.scene.environment = _G.SCENES[_G.SID].hdrtex;

works fine in every other browser and device both mobile and desktop. i can set the scene.environment the first time in vr, but it will not update after the first time.

any ideas?

The following demo applies a HDR environment map to Scene.environment and everything works as expected: three.js vr - sandbox

You probably have to modify the above example to demonstrate the issue.

I will add a dropdown for other hdrs and see if i can replicate the issue

Still stuck on this.

new THREE.RGBELoader().load(this.scene.hdr, ( _texture )=>{
    _texture.mapping = THREE.EquirectangularReflectionMapping; //THREE.CubeReflectionMapping; //THREE.EquirectangularReflectionMapping;
    this.hdrtex = _texture;
    _G.MYTHREE.scene.environment = this.hdrtex; 
    _G.MYTHREE.scene.environment.needsUpdate = true;

Is there a reason why on XR when I add another model to the scene later, the hdr is lost? I can only seem to set scene.environment one time in XR, on the second attempt it doesn’t work.Works fine on desktop and mobile. Only an issue in XR.

I’m having the same issue if I change the scene.environment while the XR session is active the result it’s different. Did you manage to find a solution?

I use this code to update the env texture, working on mobile and desktop but not in VR

 new EXRLoader(loadingManager)
                .load(config.url, (texture, textureData) => {
                    texture.matrixAutoUpdate = false;
                    texture.mapping = EquirectangularReflectionMapping;
                    scene.environment = texture;

this is the result on desktop/mobile

this is the result on VR

using r145

Maybe this is indeed an issue in the engine. Any chances to demonstrate the issue with a live example?

Sorry you’re having this issue. But happy to know someone else has this issue. I did not find a solution. It’s been an ongoing bug I could not resolve. I can get the environment hdr to work the first time on VR, but not a second time. aka, if I try to reset scene.environment, the environmental hdr map then no longer appears.

1 Like

Is there any update on this issue?

I am in the same situation. I am trying to change the scene.environment during runtime while XR session is active, but materials aren’t affected.

Its worth noting that this issue only happens with MeshStandardMaterial, other materials work as expected.

Still an issue for me too…

@FuzzyWobble Just curious to see if you know that this issue persists if an array of hdri’s are preloaded before runtime and updated at runtime or if its just the loading and updating during runtime that causes the issue? I’m sure you’ve likely tried this?

Let me check…