Set background of scene as panorama image

So far I have been use CubeMapGenerator to set background of scene as panorama.
But that was removed.
THREE.js prefer to use WebGLRenderTargetCube().
Here are some my code:

            texture.encoding = THREE.sRGBEncoding;
            var pngBackground = new THREE.WebGLRenderTargetCube( 512, 512 ).fromEquirectangularTexture( self.glRenderer, texture );
            var pmremGenerator = new THREE.PMREMGenerator( pngBackground.texture );
            pmremGenerator.update( self.glRenderer );
            var pmremCubeUVPacker = new THREE.PMREMCubeUVPacker( pmremGenerator.cubeLods );
            pmremCubeUVPacker.update( self.glRenderer );
            var pngCubeRenderTarget = pmremCubeUVPacker.CubeUVRenderTarget;

            self.glScene.background = pngCubeRenderTarget.texture;

BTW it was not clear!

How can I fix the problem?
The image for texture is panorama image.

Please help me.

Does this work?

self.glScene.background = pngBackground;

1 Like

It works fine!
Please explain me why not use pngCubeRenderTarget.texture;

Hi, niao.
How are you? I am going to set the background with a panorama image but it’s not working well.
If it works, can you share with me some codes with package versions?