-
-
Notifications
You must be signed in to change notification settings - Fork 36.2k
PMREMNode: Manage own generator, fix caching. #30504
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
|
Thank you 💯 ! |
PMREMGenerator in renderer instead of node builder.|
|
||
| const texture = this.value; | ||
|
|
||
| if ( builder.renderer.coordinateSystem === WebGLCoordinateSystem && texture.isPMREMTexture !== true && texture.isRenderTargetTexture === true ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sunag This check causes issues in the existing implementation (so without this PR) since depending on the scene setup the reflections are incorrectly flipped along the x-axis. Here is a slightly modified version of webgpu_cubemap_dynamic that demonstrates the issue:
https://jsfiddle.net/L7zn6bqs/1/
I understand you have added the check in #27988 to fix webgpu_cubemap_dynamic in the first place but it seems a different approach is needed. When each PMREMNode has its own generator, the check should no longer be required.
|
The PR also moves the texture cache in the class scope since otherwise a similar error like #30503 can occur when the same instance of |
I think it's better to relate the cache to the renderer, for example |
|
Great idea! I've added the cache back which is now hierarchical and respects the current active renderer. |
Fixed #30503.
Description
Managing a global instance ofPMREMGeneratorin the renderer solves issues when more than one renderer is used in a multi-canvas setup.I have updated the PR since integrating
PMREMGeneratorin the renderer is bad for tree-shaking. Since there are usually not manyPMREMNodeinstances per scene it should be safe when each node manages its own generator.