I’m trying to add an environment to my scene using THREE.RGBELoader and HDR images. Even though the environment is added to the scene it is not visible. This only occurs with MeshPhongMaterial. its working fine for MeshStandardMaterial
MeshStandardMaterial :
MeshPhongMaterial :
Here is the code I use to add the environment:
RGBELoader.load("MR_INT-001_NaturalStudio_NAD.hdr",
function (texture) {
texture.mapping = THREE.EquirectangularReflectionMapping;
scene.environment = texture
},
undefined,
function (error) {
buttonBussy(false);
console.error(error);
}
);
Is there any other way to add environment to MeshPhongMaterial
I was able to reproduce Three.js Material Browser. In the example they do const envMap = new THREE.CubeTexture() for MeshPhongMaterial. They also set envMap.combine = 1 | 2 (MixOperation | AddOperation).
If you want to use .hdr / .exr map instead of CubeTexture, do const envMap = useLoader(RGBELoader, 'map.hdr'); envMap.mapping = THREE.EquirectangularReflectionMapping