Should EquirectangularToCubeGenerator.update() must use the main renderer?

Hi, i’m using a panorama hdr image as envMap, so it should be processed by EquirectangularToCubeGenerator.

                let cubemapGenerator = new EquirectangularToCubeGenerator( texture, { resolution: 512 } );

                console.log( this._renderer )

                let cubeMapTexture = cubemapGenerator.Update( this._renderer! );           
                
                console.log( cubeMapTexture );
                
                let pmremGenerator = new PMREMGenerator( cubeMapTexture );

                pmremGenerator.update( this._renderer! );

                let pmremCubeUVPacker = new PMREMCubeUVPacker( pmremGenerator.cubeLods );

                pmremCubeUVPacker.update( this._renderer! );

                let envCubeRenderTarget = pmremCubeUVPacker.CubeUVRenderTarget;

                this.envMap = envCubeRenderTarget.texture as CubeTexture;

question:

  1. Should EquirectangularToCubeGenerator.update() and etc must use the main renderer? or some temp renderer just for get the cube texture?

  2. Why this EquirectangularToCubeGenerator does not have its module version?

  3. Because of lack its module version, I rewrite EquirectangularToCubeGenerator in Typescript, but the texture produced by EquirectangularToCubeGenerator.update(), its image is undefined, so the material appears black. Why?

Yes.

Because it will be replaced with WebGLRenderTargetCube.fromEquirectangularTexture(). We are going to adapted the examples soon so they are using this new method. EquirectangularToCubeGenerator will be deprecated/removed after this change.

BTW: I’ve converted EquirectangularToCubeGenerator to a module since I’m not sure WebGLRenderTargetCube.fromEquirectangularTexture() might be refactored. So with the next release R106, you can use EquirectangularToCubeGenerator directly from the repo.

3 Likes

Thank you, I created a new class extends WebGLRenderTargetCube and add the method fromEquirectangularTexture to it, problem solved, it works fine.

I don’t know why the EquirectangularToCubeGenerator module version i created (rewrite one by one as the original non-module version) always give me a black appearance, I’ll try yours.

the non-module version works also fine.