-
-
Notifications
You must be signed in to change notification settings - Fork 35.8k
scene.environmentRotation with unexpected behaviour #31018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The expected behavior is that the environment map rotation matches to the background rotation of the scene. So when both are rotated with the same value, the reflections are in sync. You can test this with webgl_materials_envmaps. The policy for the background rotation is defined in #27758 (comment). I'm not sure what value you have to apply so the reflections are in sync with your |
@Mugen87 thanks for the answer. I get that point that I had a quick look in the referenced issue. Could my described problem maybe be related to using different types of coordinate systems (left vs right handed)? This could also explain why it seem to work for rotation certain axes... Adding the studioEnvironment was just a purely for debugging of that artificial code sandbox snippet. I should just show that here the synchronized orientation with the camera is working. |
I came up with some code that should do the trick: https://jsfiddle.net/wxgfLm0t/ // use inverse/opposite rotation of the camera
q.copy( camera.quaternion ).invert();
scene.environmentRotation.setFromQuaternion( q );
// accommodate left-handed frame
scene.environmentRotation.x *= -1;
scene.environmentRotation.y *= -1;
scene.environmentRotation.z *= -1; |
Awesome thanks @Mugen87 for helping me out with a solution here! |
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
Code
Live example
Screenshots
No response
Version
175
Device
No response
Browser
No response
OS
No response
The text was updated successfully, but these errors were encountered: