SSAOPass: Replace visibility cache Map with an array for improved performance#31453
Merged
Mugen87 merged 3 commits intomrdoob:devfrom Jul 20, 2025
Merged
SSAOPass: Replace visibility cache Map with an array for improved performance#31453Mugen87 merged 3 commits intomrdoob:devfrom
Mugen87 merged 3 commits intomrdoob:devfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the SSAOPass visibility caching system to improve performance by replacing the Map-based cache with an array that only stores objects whose visibility is actually modified. The change eliminates the need to traverse all scene objects during restoration and reduces memory overhead.
- Replaces Map-based visibility cache with array for better performance
- Only caches objects that have their visibility modified (Points, Line, Line2 objects)
- Optimizes restoration by iterating only cached objects instead of entire scene
Mugen87
reviewed
Jul 20, 2025
querielo
added a commit
to querielo/three.js
that referenced
this pull request
Jul 20, 2025
Mugen87
approved these changes
Jul 20, 2025
Mugen87
pushed a commit
that referenced
this pull request
Jul 20, 2025
…formance (#31454) * GTAOPass: Replace visibility cache Map with an array for improved performance * GTAOPass: review comment #31453 (comment)
Collaborator
|
@Mugen87 There was some reason to use |
Collaborator
|
These are the "old" post porcessing classes for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors the SSAOPass class in
examples/jsm/postprocessing/SSAOPass.jsto improve how object visibility is cached and restored during the SSAO pass. It improves performance and clarity by only tracking objects whose visibility is actually modified.We can reduce the SSAO pass render time by nearly 40-50%.