Must WebGLCubeRenderTarget.fromEquirectangularTexture use the main renderer


beside scene.backround i must provide an own custom background cube. For this I need to transform equirectangular map to cubemap. I tried using WebGLCubeRenderTarget.fromEquirectangularTexture like in WebGLCubeMaps. Due to my viewers class structure it is very hard to provide the main renderer at the point i need to call fromEquirectangularTexture. Is it possible to use a second temporary renderer for this ? Currently the generated CubeTexture seems to be just black :frowning:



restructured to get the main renderer… still not working so might be somthing else:

      //got loaded texture here...
        return texture;

      let currentRenderTarget = this.#renderer.getRenderTarget();
      let renderTarget = new THREE.WebGLCubeRenderTarget( texture.image.height / 2);
      renderTarget.fromEquirectangularTexture( this.#renderer, texture );

      this.#renderer.setRenderTarget( currentRenderTarget );

      let cubeTexture = renderTarget.texture;
      cubeTexture.mapping = THREE.CubeReflectionMapping;
      cubeTexture.needsUpdate = true;
      return cubeTexture;

??? :grimacing:

No. A second renderer means a second WebGL renderering context. And it is not possible to share resources between multiple contexts. That is a WebGL limitation.

The resource in your case is a render target (or framebuffer).

So now i have restructured to use the main renderer but still its not working… any guess?

I’m not able to tell this from your code snippet. The only thing that looks wrong is:

You don’t need this line.

:astonished: YES! Just that line broke it!

Thanx :clap: :raised_hands: :+1: