Skip to content

Fix atmosphere space view for LUT rendering#22938

Open
mate-h wants to merge 2 commits intobevyengine:mainfrom
mate-h:m/atmosphere-lut-transform
Open

Fix atmosphere space view for LUT rendering#22938
mate-h wants to merge 2 commits intobevyengine:mainfrom
mate-h:m/atmosphere-lut-transform

Conversation

@mate-h
Copy link
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
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-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

1 participant