-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Fix volumetric fog artifacts when inside the fog #86103
Merged
Merged
Conversation
This file contains 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
9e19e82
to
51fb2da
Compare
51fb2da
to
532630e
Compare
clayjohn
approved these changes
Oct 23, 2024
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.
The code looks great to me! Sorry this slipped through the cracks for so long
Thanks! |
@ecmjohnson thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
cherrypick:4.3
Considered for cherry-picking into a future 4.3.x release
topic:rendering
topic:3d
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.
Resolves #74790 by forcing the froxel volume to the full frame whenever the camera could have its near plane inside the fog volume. This uses the AABB of the fog volume as a proxy for the fog volume itself. Depth can still be culled based on the farthest corner in froxel space.
The min/max corners of the fog volume are tracked while mapping each corner into froxel space. This constructs an AABB around the transformed fog volume. This AABB is then expanded by the distance from the camera position to the corner of the near plane. If the camera is inside this AABB, then only the z depth froxel coordinate can be safely culled. Otherwise, I think considering just the corners is correct.
I renamed the min/max variables to froxel_min/froxel_max to be avoid confusion with the minimum/maximum world-space corners of the fog volume. I also renamed the points variable to froxels, again to be clear these points are in froxel space.