-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Hi and thanks a ton for this great feature in Google maps / this example!
I was trying to use an environment map (with metalness / roughness - values) on my model and noticed that this doesn't seem to work with WebGLOverlayView. The reflections of the environment map on the object are static and are not updating correctly. I'm not sure if the problem is in my setup or in WebGLOverlayViewor in ThreeJS.
The video shows the result with Google Maps and WebGLOverlayView on top and the result with "normal" ThreeJS on the bottom.
2022-04-17.23-37-31.mp4
Here are my change to your code:
// load the model
loader = new GLTFLoader();
const source = "pin.gltf";
loader.load(
source,
gltf => {
gltf.scene.scale.set(25, 25, 25);
gltf.scene.rotation.x = 180 * Math.PI / 180; // rotations are in radians
scene.add(gltf.scene);
+ // Load Environment Map
+ new EXRLoader().load("/furry_clouds_2k.exr", texture => {
+ const pmremGenerator = new THREE.PMREMGenerator(renderer);
+ const exrCubeRenderTarget = pmremGenerator.fromEquirectangular(texture);
+ // Apply Environment Map
+ gltf.scene.traverse(o => {
+ if (o.material) {
+ o.material.envMap = exrCubeRenderTarget.texture;
+ o.material.envMapIntensity = 1;
+ o.material.metalness = 1;
+ o.material.roughness = 0.1;
+ o.material.needsUpdate = true;
+ }
+ });
+ });
}
);It's a pretty simple code change and I'm clueless why it's behaving like this. Please help!
PS: I also noticed that your GLTF has all inverted faces. It's not visible in your demo, but if you start changing the material settings, it becomes noticeable. Do you want a PR 🙂 ?