Description
Description
I have a current problem where I set the orientation of the environment map with the camera orientation. In doing so, I noticed an unexpected behaviour.
The specified rotation seems to have a different effect than if this rotation is applied to nodes in the scene.
I have created an example of this in Code Sandbox. When changing the camera with the arcball, the light point on the sphere should not move. However, this is only the case when rotating around the green axis. If you add the StudioEnvironment, which is used for the Envmap, as a node in the scene, it works without any problems. So applying the rotation does not have the same effect, which I would think is due to a bug or unclear documentation.
Reproduction steps
- Open Code Sandbox
- Use arcball to change camera
- light spot should stay centered for any camera orientation, but does not currently
- add StudioEnvironment to scene (and remove sphere) to see that this node is correctly following the camera orientation
Code
// this code is used to align the environment map orientation with the camera orientation
const environmentRotationMatrix = new Matrix4().lookAt(
camera.position,
camera.position.clone().negate(),
camera.up
);
scene.environmentRotation.setFromRotationMatrix(environmentRotationMatrix);
Live example
Screenshots
No response
Version
175
Device
No response
Browser
No response
OS
No response