My main objective was to rotate the environment but keeping the gltf or object form rotating.
I managed to do that using backgroundRotation from the scene.backgroundRotation
but on testing I noticed that the lighting was not rotating with the background.
I wonder how I should do that.
loadEnvironment(url, check) {
this.hdrProgress = 0;
new RGBELoader().load(
url,
(texture) => {
const gen = new THREE.PMREMGenerator(this.renderer);
this.envMap = gen.fromEquirectangular(texture).texture;
this.scene.environment = this.envMap;
this.scene.background = this.envMap;
console.log(this.envMap);
texture.dispose();
gen.dispose();
},
(xhr) => {
this.hdrProgress = (xhr.loaded / xhr.total) * 100;
},
);
this.progressLoader(check);
}
rotateBackground(angle) {
const radians = parseFloat(angle) * (Math.PI / 180);
this.scene.backgroundRotation = new THREE.Euler(0, radians, 0);
}
I’ll attach the pictures
Before rotation
After rotation
Ideal Usecase
In the ideal usecase image you can see there is no glare at the object when it is facing the wall
and in the before rotation image when camera faces the window there is glare at the object and that is fine. Issue => Suppose camera is facing the window and there is glare on the object now I use the rotateBackground function to rotate -180deg that would result in the After rotation image. and see there is glare on the object even when it is facing the wall.
I know my explanation is kinnda messy, please bear with me and feel free to ask question for clarification.
Any help is appreciated.