CubeTexture from CubeCamera used as an Environment map on a Mesh appears to shift based on roughness

Hey All,

Setup (Pictures included):
Three JS v.129
I have a CubeCamera that is positioned where my scene Camera is positioned. And the basic cube camera / render target set up here:

          const cubeRenderTarget = new WebGLCubeRenderTarget( 2048, {
            format: RGBFormat,
            generateMipmaps: true,
            encoding: sRGBEncoding
          const cubeCamera = new CubeCamera( 1, 200, cubeRenderTarget );    
          obj.material.envMap = cubeRenderTarget.texture; 

//obj is the floor Mesh that will be in the screenshots.

and this is how I positioned the camera (cd is an object that references the mesh using the cube texture and cube camera).

      cd.mesh.visible = false;
      // is the main scene camera;,this.scene);
      cd.mesh.visible = true;

And once loaded, I call the update function on the CubeCamera to have it update the CubeTexture its producing. The CubeTexture is then set as the meshes environment map. The Mesh uses MeshStandardMaterial.

Everything works well when the Mesh’s material is set at roughness 0:

But when roughness increases it looks like the image shifts up a little bit.
Roughess at .2:

And just to show one more example, Roughness at .4

Is it natural for the image to zoom/shift up as roughness increases? If so is there way for it to keep its position but just be less reflective? Or maybe I am doing something wrong.

And to clarify, the camera never moves and I am reinitializing the scene every time I change the roughness. So the conditions are the same each time I took an image.

Thanks a lot!

1 Like

Here is a video demonstrating this:

1 Like

If you set generateMipmaps to true, you also have to change the texture filter settings. Add minFilter: LinearMipmapLinearFilter to your render target configuration.

Do you get better results with different texture filtering?

Hey Mugen!

Thanks for always being there to answer questions haha. You were right the minFilter worked.

1 Like