Skip to content
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

WebGPURenderer: Support rotation of env maps. #30528

Merged
merged 3 commits into from
Feb 15, 2025
Merged

WebGPURenderer: Support rotation of env maps. #30528

merged 3 commits into from
Feb 15, 2025

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented Feb 15, 2025

Fixed #30523.

Description

The PR adds support for Scene.environmentRotation and material.envMapRotation.

@sunag An open issue is a circular dependency that was the main reason why I not implemented this feature straight away with #29762:

src/nodes/accessors/MaterialNode.js -> src/nodes/accessors/ReferenceNode.js -> src/nodes/accessors/CubeTextureNode.js -> src/nodes/accessors/MaterialNode.js

Do you have an idea how to refactor the code so the circular dependency disappears?

@Mugen87 Mugen87 marked this pull request as draft February 15, 2025 11:47
Copy link

github-actions bot commented Feb 15, 2025

📦 Bundle size

Full ESM build, minified and gzipped.

Before After Diff
WebGL 336.36
78.33
336.36
78.33
+0 B
+0 B
WebGPU 518.34
143.87
518.75
143.97
+405 B
+107 B
WebGPU Nodes 517.81
143.75
518.21
143.86
+405 B
+107 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Before After Diff
WebGL 465.35
112.17
465.35
112.17
+0 B
+0 B
WebGPU 590.22
159.83
590.58
159.93
+361 B
+94 B
WebGPU Nodes 545.58
149.3
545.88
149.4
+304 B
+103 B

* @tsl
* @type {Node<float>}
*/
export const materialEnvIntensity = /*@__PURE__*/ uniform( 1 ).onReference( ( { material } ) => material ).onObjectUpdate( function ( { material, scene } ) {
Copy link
Collaborator Author

@Mugen87 Mugen87 Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change the update scope from render to object otherwise different intensity values in different materials were not honored correctly. Same for rotation and refraction ratio.

@Mugen87 Mugen87 added this to the r174 milestone Feb 15, 2025
@Mugen87 Mugen87 marked this pull request as ready for review February 15, 2025 22:24
@sunag sunag merged commit a39dbfa into mrdoob:dev Feb 15, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WebGPU & TSL envMapRotation
2 participants