PBR transmission with dynamic cubemaps incorrect

I am trying to use a dynamic cubemap with a PBR material which has also transmission > 0. When I combine the transmission example with the dynamic cubemap example

here

it does not quite work out. There is dynamic reflection shown on the transmissive sphere but the texture mapping is quite off.

Interestingly, for zero transmission the shading mode changes and the dynamic cubemap is shown correctly.

This may hint that only minor changes may be needed, either to how the cubemap is used or perhaps the texture mapping application.

PMREMGenerator, CubeCamera and envmap mirroring issues - #9 by phxbf is possibly related. The above cubemap also looks mirrored:

Not worried about performance of any solution, eg. regenerating something each frame.

Updated

because unpkg was not serving reliably.

To clarify, in this image


the dynamic cubemap used as envmap is circled. It should not be restricted to the small square area but should cover the complete, striped sphere. Setting transmission to 0 shows the correct mapping for the cubemap. Perhaps the cubemap is using the same UVs as the texture internally used for the transmission if there is transmission ?

This may be the same question:

I think it’s best if you report this issue at GitHub. Looks like a problem with the transmission code path.

Thanks: dynamic cubemap mapping incorrect for transmission > 0 with PBR material · Issue #25281 · mrdoob/three.js · GitHub

1 Like

As noted in the issue there is a simple workaround/solution:

mesh.visible = false;
cubeCamera.update( renderer, scene );
mesh.visible = true;

This works great but why is it necessary ? Perhaps there is an obvious explanation ?

I think the cube camera can’t render its views correctly when it is placed inside a (double-sided) mesh. So the idea is to make the mesh invisible so nothing is occluded.

Well, the cube camera does work correctly if transmission is zero even when placed inside. Also, it works correctly in the dynamic cube map example with TwoPassDoubleSide where it is also inside the sphere. So there should be something else which conflicts with transmission.

But it makes sense that a rendered inside would occlude everything else. Conceptually, it would make sense to set the position of the camera far away from the origin, in the reverse look at direction, for each side. This seems like something which probably was discussed a long time ago, and discounted. Perhaps because it is difficult to know what ‘far away’ means.