Skip to content

Fix atmosphere space view for LUT rendering#22938

Merged
alice-i-cecile merged 6 commits intobevyengine:mainfrom
mate-h:m/atmosphere-lut-transform
Mar 4, 2026
Merged

Fix atmosphere space view for LUT rendering#22938
alice-i-cecile merged 6 commits intobevyengine:mainfrom
mate-h:m/atmosphere-lut-transform

Conversation

@mate-h
Copy link
Copy Markdown
Contributor

@mate-h mate-h commented Feb 13, 2026

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

  • Compute the atmosphere frame with local up for zenith and a world-fixed azimuth
  • Use the atmosphere transform for both LUT generation and sampling via direction_world_to_atmosphere, effectively reverting this code block to the previous state before PR Raymarched rendering for atmosphere and spherical coordinates #20766
  • Raymarch the sky view LUT from the actual camera position.

Testing

  • Ran the atmosphere example by increasing the scene's scale
AtmosphereSettings {
    scene_units_to_m: 10e4,
    aerial_view_lut_max_distance: 3.2e4 * 128.0,
    ..default()
},

Showcase

new LUT based rendering:
lutbased

raymarched rendering for reference "ground truth":
raymarched

@mate-h mate-h requested review from IceSentry and ecoskey February 13, 2026 07:50
@mate-h mate-h added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Feb 13, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Rendering Feb 13, 2026
@mate-h mate-h changed the title Fix space views for lut rendering Fix atmosphere space views for LUT rendering Feb 13, 2026
@mate-h mate-h changed the title Fix atmosphere space views for LUT rendering Fix atmosphere space view for LUT rendering Feb 13, 2026
Comment thread crates/bevy_pbr/src/atmosphere/resources.rs Outdated
Comment thread crates/bevy_pbr/src/atmosphere/resources.rs Outdated
Comment thread crates/bevy_pbr/src/atmosphere/resources.rs
@mate-h mate-h added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Mar 3, 2026
@alice-i-cecile alice-i-cecile added this pull request to the merge queue Mar 4, 2026
Merged via the queue into bevyengine:main with commit d0e82f2 Mar 4, 2026
38 checks passed
@github-project-automation github-project-automation Bot moved this from Needs SME Triage to Done in Rendering Mar 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants