-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGLRenderer: Add support for rotating env maps. #27758
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
In what coordinate frame is the background Euler rotation applied? I assume you intend it to be the three.js right-hand coordinate frame. In the shader, the coordinate frame is left-handed. In this PR, the background rotation around the x-axis is backwards from the expected convention. A sign flip may fix that. |
Do you intend to add support for rotating |
Yes. I was a bit unsure about the point of reference when judging the direction of rotations for env maps. I hope the last commit fixes the x-axis issue.
Users can already achieve that by modifying the new I would only add an additional option if users struggle with the existing solution. |
Hmmm... I think |
I think it would be better to add support for |
The problem with this approach is that How about we add |
I also think it's in general more flexible to have the ability to rotate environment maps directly in the material (if we don't provide a per texture setting). |
That sounds good to me. I guess |
Yes, I think we can nicely put this check in |
Okay, |
Fix typo.
The reflections and rotations are not correct. I'll file a PR in an attempted fix. Unfortunately, getting these calculations correct has taken considerable effort... |
Fixed #16328.
Description
This PR adds a frequent requested feature to
WebGLRenderer
: The ability to rotate environment maps.Instead of adding a new property to
Texture
level, I've realized a more clean approach by adding:Scene.backgroundRotation
which controls the rotation of the scene's skybox as suggested in CubeTexture orientation #16328 (comment).Scene.environmentRotation
which controls the rotation of the scene's environment as suggested in WebGLRenderer: Add support for rotating env maps. #27758 (comment).envMapRotation
for all materials which supportenvMap
.The new properties are of type
Euler
. Environment maps in the equirectangular, cube map and cuveUV (PMREM) format can be rotated now.