PMREMGenerator, CubeCamera and envmap mirroring issues

Following a few examples, I was trying to use PMREMGenerator that seems to produce better results for lightprobing stuff.
On latest THREE release seems that CubeCamera and PMREM produce wrong results for envmap associated with a mesh (…or I’m using them the wrong way)

The mesh used in this test and its normals are correct.

Relevant code:

pmremGenerator = new THREE.PMREMGenerator(renderer);

CCtarget = new THREE.WebGLCubeRenderTarget( 128, {
        format: THREE.RGBEFormat,
        generateMipmaps: true,
        minFilter: THREE.LinearMipmapLinearFilter,
        encoding: THREE.sRGBEncoding

CC = new THREE.CubeCamera( this._near, this._far, CCtarget );

CC.position.copy( probeLocation ); // green dot location
CC.update( renderer, scene );

envtex = pmremGenerator.fromCubemap(CCtarget.texture).texture; // the envmap associated w/ mesh

The issues seems that final enmap looks in the correct location but “mirrored” - as you can see in the screenshot (green and blue reflections are wrong). Green dot represents the CubeCamera location.


On the other hand, pmremGenerator.fromScene produces correct results, although the capture is preformed in the origin, and it seems I have no control on shot location.

What could be the issue? I’m trying literally everything (including flipping final envtex, but no change)


This is another (simpler) test with just a PBR sphere, two quads and a panoramic content (bigger textured sphere) that confirms pmremGenerator.fromCubemap(CCtarget.texture).texture returns a wrong (mirrored) envmap assigned to the mesh


I tried a lot of things, including mirroring the CubeCamera (CC.scale.x = -1), but indeed it does not work.
The only (ugly) workaround so far is mirroring the entire scene along x-axis before the CC.update( renderer, scene ), while properly transforming CubeCamera location.

Anyone has encountered something similar?
Is there a cleaner solution to mirror or fix the returned envmap from PMREMs ?

I’m experiencing this issue on r132.2 and r133

Hey @phxbf did you solve this?

I am facing the same issue. I tried everything and searched everywhere, without finding any possible solution.

Not yet unfortunately.
I’m using the hack of mirroring the scene along x-axis before the CubeCamera update. I suppose it is something (maybe simple) to fix in the GLSL shader(s) but I dont know exactly where

You can actually translate the scene in order to achieve this. Meaning the camera stays at the origin but the scene itself is shifted.