TransformUV is not work if I have ShaderMaterial?

I create Object as:

var myObject = new Mesh( getMaterial(), getGeometry(size));

and create material as ShaderMaterial:

function getMaterial() {
const cubeShader = THREE.ShaderLib.cube;
cubeShader.uniforms['tCube'].value = getCubeTexture();
return new THREE.ShaderMaterial({
fragmentShader: cubeShader.fragmentShader,
vertexShader: cubeShader.vertexShader,
uniforms: cubeShader.uniforms,
side: THREE.BackSide,
});
}

function getCubeTexture() {
  const cubeTexture = new THREE.CubeTexture([]);
  const imageLoader = new THREE.ImageLoader();
  imageLoader.setCrossOrigin('anonymous');
  imageLoader.load(
    resources.ThreeView.texture,
    texture => {
      cubeTexture.images.push(getImageSide(2, 1, texture)); // p x
      cubeTexture.images.push(getImageSide(0, 1, texture)); // n x
      cubeTexture.images.push(getImageSide(1, 0, texture)); // p y
      cubeTexture.images.push(getImageSide(1, 2, texture)); // n y
      cubeTexture.images.push(getImageSide(1, 1, texture)); // p z
      cubeTexture.images.push(getImageSide(3, 1, texture)); // n z

      cubeTexture.needsUpdate = true;
    },
    undefined,
    err => console.error('Error loading a cube texture:', err)
  );

  return cubeTexture;
}

All in all, I have CubeTexture with ShaderMaterial

uniforms['tCube'].value I have CubeTexture

image

And then I want to do transformUv:

material.uniforms['tCube'].value.transformUv(uv);

But it doesn’t work correctly

Im my project I find intersection in this way:

  function raycastColor(event) {
    var screen = this.getMouseOnScreen(event.clientX, event.clientY);
    var interesects = this.getIntersect(screen, this.object);
    if (interesects.length === 0) return null;

    var uv = interesects[0].uv;
    this.object.material.map.transformUv(uv);

    var x = (uv.x * this.canvas.width) >> 0;
    var y = (uv.y * this.canvas.height) >> 0;

    this.currentRaycastData.point = {
      x: interesects[0].point.x,
      y: interesects[0].point.y
    };
    this.currentRaycastData.texturePoint = { x: x, y: y };

    var data = this.ctx.getImageData(x, y, 1, 1).data;

    if (data[3] < 10) return null;

    return new THREE.Color(data[0] / 255, data[1] / 255, data[2] / 255);
  }

I works if I have a sphere with simple texture with one image if I create Material as:

var material = new THREE.MeshBasicMaterial({
    map: new THREE.TextureLoader().load(MAP.texture)
  });

The cube shader does not use texture coordinates since textureCube() does not need them. Hence, the transforming has no effect.

And what can I do with this?

Sorry, I don’t understand your question. Are you asking for the purpose of Texture.transformUv()?