CubeTexture got from HDR breaks shader after v137

Hi Forum,

I’m updating the threejs version of my app. Everything was going fine until v137.
For some reason, the CubeTexture has changed and is not ready for being used as a parameter anymore by the shader function envMapTexelToLinear.

This is how I get the Cube Texture based on an HDR file.

const loader = new RGBELoader();
    loader
      .load(
        'aURL.hdr',
        (texture) => {
          const cubeRenderer = new WebGLCubeRenderTarget(512);
          const envMap = cubeRenderer.fromEquirectangularTexture(renderer, texture).texture;
          onReady(envMap);
        },
        onProgress,
        onError
      );
  }

Later in the shader, when trying to map the texture to a vector 4

vec4 env = envMapTexelToLinear(textureCube(envMap, reflectedView));

I got these errors

FRAGMENT

ERROR: 0:109: 'envMapTexelToLinear' : no matching overloaded function found
ERROR: 0:109: '=' : dimension mismatch
ERROR: 0:109: '=' : cannot convert from 'const mediump float' to 'highp 4-component vector of float'

As part of v137 migration guide, I see several changes related to texture formats. Some of these changes have impacted the CubeTexture resolution, and I have to make changes to get this to work again.

Could somebody point me in the right direction, please?

Got it working by just not using envMapTexelToLinear function anymore as part of the shaders.

I figured it out by reviewing the package diff

2 Likes