fix(GTAOPass): exclude Line2 objects from AO calculation #31422
Merged
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.
Description
This PR fixes a rendering issue where black squares appear at the world center when using Line2 objects with GTAOPass.
Problem:
When Line2 objects are present in a scene that uses GTAOPass for ambient occlusion, black artifacts (squares) appear at the world center during rendering.
Root Cause:
The GTAOPass's
_overrideVisibility()
method was not excluding Line2 objects from AO calculation. While Points and Line objects were already properly excluded, Line2 objects were inadvertently included in the ambient occlusion rendering pass, causing rendering artifacts.Solution:
Added
|| object.isLine2
condition to the visibility override check inGTAOPass._overrideVisibility()
. This ensures Line2 objects are treated consistently with other line-based objects (Points and Line) and are excluded from AO calculations.Changes:
examples/jsm/postprocessing/GTAOPass.js
line 660 to include Line2 objects in the visibility override condition