This is the code I used to load HDRI
Full code: GitHub - SadmanYasar/3D-Car-Viewer
new RGBELoader()
.load('textures/autoshop_01_2k.hdr', (texture: Texture) => {
texture.mapping = EquirectangularReflectionMapping;
// background remains same if color used instead of texture
scene.background = texture;
scene.environment = texture;
texture.dispose();
// load models asynchronously
const loader = new GLTFLoader();
loader
.loadAsync(url)
.then((gltf) => {
gltf.scene.traverse((object) => {
object.layers.set(layer);
});
scene.add(gltf.scene);
});
});
Initially the models and HDRI load fine but when I change camera layer, the models for that layer load but the scene background becomes black. I tried console logging scene.background when the layer changed but found no difference between the results. This issue is occurring after I started using Typescript and Webpack on this project. What could be done to solve this issue?