How can I get each side of cubeTexture

I’m trying to make parallax corrected cubemapping with shaderMaterial.
What I want to do is to get each side of cubeTexture,which is from reflection probe, than pass it to shader through uniform. I know how to pass the texture, but I dont know how to get each side image of cubemap.

I would recommend to instead pass the cubetexture itself and then use a sampler cube to read data from the face you want

But I have an issue in TypeScript I can’t pass a CubeTexture to ShaderMaterial :slight_smile:

this.material.setTexture(‘cubeMap’, new CubeTexture(‘assets/envmap/desk’, this.scene));
causes a Typescript compilation error.
If I do
this.material.setTexture(‘cubeMap’, new CubeTexture(‘assets/envmap/desk’, this.scene) as unknown as Texture);
it works and I can use the samplerCube, is it planned to be fixed ?

setTexture and setTextureArray take a Texture, whereas CubeTexture subclasses BaseTexture.

As I could not see any problem with the two methods taking BaseTexture instead, I made a PR:

3 Likes

Thank you very much
:relaxed:

1 Like