Fix atmosphere space view for LUT rendering#22938
Open
mate-h wants to merge 2 commits intobevyengine:mainfrom
Open
Fix atmosphere space view for LUT rendering#22938mate-h wants to merge 2 commits intobevyengine:mainfrom
mate-h wants to merge 2 commits intobevyengine:mainfrom
Conversation
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.
Objective
Since introducing spherical coordinate systems and space views for Bevy's atmosphere in PR #20766, the LUT-based rendering had a remaining bug: when tilting the camera and viewing Earth from space, the lit/dark terminator rotated with the view instead of staying fixed. Raymarched rendering was correct, only the LUT path was affected. This PR fixes that by using an atmosphere frame that keeps the terminator stable while still concentrating texel density toward the horizon as in the Hillaire paper.
This is what the bug reproduction looks like on main:
Screen.Recording.2026-02-12.at.11.45.31.PM.mov
With this change, the atmosphere rendering from space is officially supported using the LUT based method. That can be taken advantage of in lower end devices, or on a tight performance budget.
Solution
direction_world_to_atmosphere, effectively reverting this code block to the previous state before PR Raymarched rendering for atmosphere and spherical coordinates #20766Testing
Showcase
new LUT based rendering:

raymarched rendering for reference "ground truth":
