-
-
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
WebGPURenderer: Introduce PostProcessingUtils
#29595
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
@@ -50,6 +51,10 @@ class AfterImageNode extends TempNode { | |||
|
|||
const { renderer } = frame; | |||
|
|||
_rendererState = PostProcessingUtils.resetRendererState( renderer, _rendererState ); |
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.
Regarding the name: I would expect something like saveRendererState()
since what we doing here is essentially saving a snapshot of the current render state which is later restored. So how about:
const rendererState = PostProcessingUtils.saveRendererState( renderer );
PostProcessingUtils.restoreRendererState( renderer, rendererState );
* Codesplit WebGL/WebGPU entrypoints * Keep src/Three.js as WebGL entrypoint * Restore unused three.webgpu.nodes.js * Restore duplicate entrypoint * Remove duplicate WebGPU.Nodes artifact * Revert "Remove duplicate WebGPU.Nodes artifact" This reverts commit 418db9b. * Prevent duplicate core artifacts * Updated builds. * Try removing builds. * Revert "Try removing builds." This reverts commit 880e8bb. * Puppeteer: inject into core chunk * Updated builds. * Remove builds. * Three.WebGPU: resolve conflicts #29595 * Isolate Nodes bundles due to chunking * WebGPU.Nodes: restore individual exports * Revert isolation of WebGPU.Nodes build * Isolate Nodes bundles due to chunking * Revert "Isolate Nodes bundles due to chunking" This reverts commit ba0c5b4. * Try isolating Nodes in different order * Cleanup --------- Co-authored-by: Michael Herzog <[email protected]>
Description
It is common when we create some rendering passes to change the renderer settings, this is a common approach and currently we are doing it value by value instead of a function to handle it.
PostProcessingUtils
hasresetRendererState()
that will reset the renderer to default values. This is important not only to store and restore but also to reset so that some pre-rendering or post-processing layers are not affected by specific settings.Using
getRendererState()
andsetRendererState()
simplifies the process to modify the rendering settings that need to be restored later, and makes the system more controlled if we add new features to the renderer.