Skip to content

scene.environmentRotation with unexpected behaviour #31018

Open
@DIeHarke

Description

@DIeHarke

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

  1. Open Code Sandbox
  2. Use arcball to change camera
  3. light spot should stay centered for any camera orientation, but does not currently
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions