Skip to content

fix(render): Bruneton atmosphere stays off until measured - #395

Merged
lazyxeon merged 9 commits into
mainfrom
cursor/wire-atmosphere-568b
Oct 21, 2026
Merged

lazyxeon merged 9 commits into
mainfrom
cursor/wire-atmosphere-568b

Conversation

@lazyxeon

@lazyxeon lazyxeon commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Description

Draft. Does not merge. Rebased onto main at 7427bc05.

The default stays off. gpu_frame_budget calls budget_gate::reject_gated_flags. --atmosphere alone is accepted. The reason is that draw_into clears HDR and depth, the main pass loads both, and record_bruneton copies the time-of-day sun onto that sky. --atmosphere=false and --atmosphere false are off. Every other enabled gated flag bails, including a second flag beside --atmosphere. The lib test is the list.

record_bruneton passes the light direction as the sun, or the time-of-day sun when that vector is empty. Near and far come from clip_planes of the bound camera. The game camera and the budget camera are GAME_ZNEAR / GAME_ZFAR (0.1 / 500).

The printed mode is atmosphere_with_aravath_fog only when both pipelines built. Otherwise the binary bails before a median.

screen_ndc.wgsl is deleted. screen_uv_to_ndc is inlined in fog_density.wgsl and scatter.wgsl. The shaft pixel test enables height fog on the same rows, and a flipped ndc.y fails that assert.

Invariant 22 keeps main's Hi-Z sentence and the false-flag sentence. last_verified_commit is 8d6e9867. The evidence column names reject_gated_flags, which the bin calls.

Water at depth 1, the cloud unproject, and the shaft depth cutoff are #405.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Security enhancement

Security Considerations

  • Does this PR introduce new dependencies? No.
  • Does this PR modify how user input is handled?
  • Does this PR change authentication or authorization mechanisms?
  • Does this PR access sensitive data or modify how it's stored?
  • Does this PR introduce new network communication or modify existing protocols?

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have made corresponding changes to the documentation

Test plan

  • cargo test -p astraweave-render --lib reject_gated_flags_covers_each_form — --atmosphere alone is accepted; the reason names the clear and record_bruneton
  • cargo test -p astraweave-render --test gated_passes atmosphere_sky — shafts brighten the upper row; height fog is stronger on the lower row. A flipped ndc.y failed that fog assert (upper gain 151, lower gain 113) and was restored
  • cargo clippy -p astraweave-render --locked --lib --no-deps -- -D warnings
  • Pull-request CI on 3eacf8a9
Open in Web Open in Cursor 

@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: lazyxeon/AstraWeave/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e0e3cafe-13bb-4589-849d-5b02f895b4b9
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

1 similar comment
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Do not enable this path. PresentationQuality::Measured leaving Bruneton off is the right call: the published 3.688 ms heavy-scene figure does not include the pass, and gpu_frame_budget has no --atmosphere switch. The shader and bind-group change behind PresentationQuality::Atmosphere still builds the wrong sky, and the tests never look at a pixel.

HEAD is 5e172835. The title still says the pass is on by default. c4d173cd did turn it on and called the cost “about 1 ms”. That number is an estimate. The follow-up put the default back to off and left the composite in place.

What holds

  • Sim determinism. No replay case, save, or tick reads this. The diff does not write simulation state, sample wall time, or draw an unseeded RNG. The nineteen cross-OS cases stay on the CPU sim.
  • Security. No new unsafe, no discarded Result on I/O, no user-supplied shader. textureLoad of t_sky sits after the workgroup bounds check. Binding 6 matches the new layout (Float { filterable: false }). sky_view is the full-resolution rgba16float target, so the coordinate is the screen pixel. The sky write and the aerial sample are separate compute passes.
  • Call path. Renderer::new still starts with atmosphere_on: false. Aravath draws through render_with → draw_into, which is the path that records the pass. render() never does.

Blocking

The inline comments cover the sky mask, the missing depth/HDR clear, the non-inverted view-projection, the measurement command that does not exist, the smoke test that forbids the default ever changing, and the trace gap.

I did not re-run gated_passes on a GPU in this pass. The submit test would only prove the encoder is accepted. It would not catch the mask or the ray matrix.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread astraweave-render/src/renderer.rs Resolved
Comment thread aravath_runtime/src/main.rs Resolved
Comment thread astraweave-render/tests/gated_passes.rs Resolved
@cursor
cursor Bot force-pushed the cursor/wire-atmosphere-568b branch from 5e17283 to ac57bb6 Compare October 21, 2026 05:08
@cursor cursor Bot changed the title feat(render): Bruneton atmosphere on by default fix(render): Bruneton atmosphere stays off until measured Oct 21, 2026
@cursor
cursor Bot changed the base branch from main to cursor/wiring-campaign-inventory-568b October 21, 2026 05:08
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD ac57bb6f fixes the sky mask, the missing HDR/depth clear, the uninverted view-projection, the Y-up NDC mapping, and the missing --atmosphere bench flag. PresentationQuality::Measured leaving the pass off is the right default. The title still says the pass is on by default.

PresentationQuality::Atmosphere is not a safe on-switch yet. Aravath composites volumetric fog and god rays into HDR, then aerial scatters that color again, and the bench that is supposed to authorize the flip does not draw fog.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG. The star field is a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim.
  • Security. No new dependency, no new unsafe, no discarded Result on I/O, no user-supplied shader. textureLoad of t_sky sits after the workgroup bounds check. Binding 6 is Float { filterable: false }, which matches the rgba16float sky target. The sky storage write and the aerial sample are separate compute passes.
  • The prior mask bugs. depth_raw == 1.0 matches the Depth32Float clear of 1. draw_into clears HDR with hdri_sky_clear_color and depth to 1 before the main pass loads both. prepare_frame now gets (cached_proj * cached_view).inverse(). toward_sun = -light_dir matches the PBR shader (L = normalize(-uCamera.light_dir)). uv.y 0 maps to NDC y +1 in both sky and aerial. --atmosphere is the only gated flag that records a frame; SSGI, TAA, upscale, DoF, and the cloud raymarch bail before a submit.
  • Trace. §5, invariant 25, and §11 describe this path. The --atmosphere command in the previous trace comment now exists.

Still open

The inline comments cover the fog stack, clip_planes on the new 20 km camera, the resize hole, the pixel test that can pass on the clear color, and the campaign row that still describes the pre-change tree.

I did not re-run gated_passes on a GPU. The projection math puts the three sample points on the near quad, the far quad, and empty sky, but that does not prove the sky branch was taken.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread aravath_runtime/src/main.rs Resolved
Comment thread astraweave-render/src/renderer.rs Resolved
Comment thread astraweave-render/src/renderer.rs Resolved
Comment thread astraweave-render/tests/gated_passes.rs Resolved
@cursor
cursor Bot force-pushed the cursor/wire-atmosphere-568b branch from ac57bb6 to d7b932c Compare October 21, 2026 06:41
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD d7b932c2 fixes the sky mask, the HDR and depth clear, the inverse view-projection, the Y-up NDC mapping, the 20 km clip_planes fallback, the resize hole, and the missing --atmosphere bench flag. PresentationQuality::Measured leaving the pass off is still the right default.

PresentationQuality::Atmosphere is not a safe on-switch. Fog and god rays composite into HDR, then aerial replaces every cleared pixel with the Bruneton sky, so the sky loses both. The pixel test never turns those passes on, and a failed fog or shaft build still prints atmosphere_with_aravath_fog.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG. Stars are a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim.
  • Security. No new dependency, no new unsafe, no discarded Result on I/O, no user-supplied shader. textureLoad of t_sky sits after the workgroup bounds check. Binding 6 is Float { filterable: false }, which matches the rgba16float sky target. The sky storage write and the aerial sample are separate compute passes. --atmosphere is an exact argv match, and a second gated flag still bails before the device is created.
  • Prior mask bugs. depth_raw == 1.0 matches the Depth32Float clear of 1. draw_into clears HDR with hdri_sky_clear_color and depth to 1, and the main pass loads both. prepare_frame gets (cached_proj * cached_view).inverse(). toward_sun = -light_dir matches the PBR shader. uv.y 0 maps to NDC y +1, the same mapping as pbr.wgsl. Renderer::resize resizes the pass, and record_gated_presentation resizes again if the extent drifted.
  • clip_planes. For glam 0.30 perspective_rh, near 0.1 / far 20 km returns about 19973 m (the f32 loss the test allows). Far 200 m and far 500 m stay on the real plane. The old 500 m fallback is gone.

Still open

The inline comments cover the sky overwrite, the pixel test that never enables Aravath fog, the bench label that survives a failed fog or shaft build, and invariant 22 still saying --atmosphere is rejected.

Two dependencies sit under the measured frame. fixed_camera is near 0.1 / far 200, while ThirdPersonCamera::new is far 500, so the froxels are not the game camera's spacing. god_rays.wgsl treats depth ≥ 0.999 as a light source (about 67 m at the bench far plane, about 83 m at Aravath's 500 m), and update_params maps NDC y with ndc * 0.5 + 0.5 while the rasterizer and the new sky use the flipped uv. Shafts on geometry can point away from the Bruneton sun. That projection predates this pull; the new sky makes the split visible.

I did not re-run gated_passes on a GPU. At the test camera, (60, 32) is empty sky, (32, 32) is the far quad, and (10, 32) is the near quad.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread astraweave-render/tests/gated_passes.rs Resolved
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD 341c2ac4 copies the Bruneton sky onto HDR before volumetric fog and god rays, and gpu_frame_budget bails before a median when either of those pipelines failed to build. PresentationQuality::Measured leaving the pass off is still the right default.

The sky pixel test does not lock that composite. Fog and shafts unproject screen y with the opposite sign from the sky and from pbr.wgsl, and the new asserts sample the horizon row, where the two conventions agree.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG for a pixel. Fog time advances by a fixed 1/60 per composite. Stars stay a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim.
  • Security. No new dependency, no new unsafe (astraweave-render denies it), no discarded Result on the new bail, no user-supplied shader. flag_on is an exact argv match, and a second gated flag still bails before the device is created. textureLoad of t_sky sits after the workgroup bounds check. The aerial texture is rgba16float with COPY_SRC, and HDR has COPY_DST.
  • The reorder. Both draw_into depth paths call record_bruneton and then composite_atmosphere. Aerial still stores the sky texture only at depth exactly 1. With fog or shafts enabled, scatter_geometry is false, so geometry is one scatter. A failed VolumetricFogPass::new or GodRayPass::with_config clears the pass, the enabled queries stay false, and the printed mode is atmosphere_without_fog, atmosphere_without_shafts, or atmosphere_without_volumetrics.
  • Prior mask, clear, matrix, resize, and far plane. Those fixes from d7b932c2 are still in this tree. clip_planes keeps a 20 km plane. Renderer::resize resizes the pass with the window.

Still open

The inline comments cover the mirrored froxel and shaft projection, the horizon pixel the new test samples, and invariant 22 still saying --atmosphere is rejected.

fixed_camera is near 0.1 / far 200. ThirdPersonCamera::new is far 500. The froxel exponential uses whichever far clip_planes returns, so the measured slices are a different spacing from the game camera. The dispatch count matches. The image does not.

Water still writes HDR with read-only depth. A water pixel left at depth 1 is replaced by the sky texture on the way into the composite. The heavy scene does not draw water.

I did not re-run gated_passes on a GPU. The horizon asserts can go green on a mirrored composite.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread astraweave-render/tests/gated_passes.rs Resolved
Comment thread astraweave-render/src/renderer.rs Resolved
cursor Bot pushed a commit that referenced this pull request Oct 21, 2026
Fog and god rays belong to #395, not to light_the_world. prepare_frame
on this head still passes a zenith sun, and that gap stays with #395.
The last matching aravath.cfg key wins. DoF writes AdvancedPostFx's
"TAA History" texture, which is not TaaPass history, so both defaults
stay off. Invariant 22 was re-read at 85ad478.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
@cursor cursor Bot mentioned this pull request Oct 21, 2026
9 of 18 tasks
cursor Bot pushed a commit that referenced this pull request Oct 21, 2026
Fog and god rays belong to #395, not to light_the_world. prepare_frame
on this head still passes a zenith sun, and that gap stays with #395.
The last matching aravath.cfg key wins. DoF writes AdvancedPostFx's
"TAA History" texture, which is not TaaPass history, so both defaults
stay off. Invariant 22 was re-read at 85ad478.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
cursor Bot pushed a commit that referenced this pull request Oct 21, 2026
The trace keeps main's v1.48 Hi-Z wording and adds the gated-flag
reject sentence on the timestamp row. last_verified_commit is
83798b4. #395 owns the clear, the sky sample, and the sun. Fog and
god rays stay light_the_world callers. flag_on accepts a bare flag,
=true, and a two-token true, and the SSGI, TAA, and upscale errors
name the uncopied history images.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/wiring-campaign-inventory-568b branch from 351559d to f72defd Compare October 21, 2026 08:20

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD d49d6026 puts fog froxels and the shaft sun on the same screen mapping as the sky and pbr.wgsl (ndc.y = 1 - 2*uv.y, uv.y = 0.5 - 0.5*ndc.y). PresentationQuality::Measured leaving the pass off is still the right default.

The new pixel test does not lock that shaft mapping. Its sun is outside the frustum, so the shaft pass stores black. fog_density.wgsl no longer parses on its own. Invariant 22 still says --atmosphere is rejected.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG for a pixel. Fog time still advances by a fixed 1/60 per composite. Stars stay a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim. GAME_ZFAR is the same 500.0 the third-person camera already used.
  • Security. No new dependency, no new unsafe (astraweave-render denies it), no discarded Result on the degraded-build bail, no user-supplied shader. flag_on is an exact argv match (--atmosphere or --atmosphere=true). A second gated flag still bails before the device is created. textureLoad of t_sky sits after the workgroup bounds check.
  • The mapping. screen_uv_to_ndc / ndc_to_screen_uv match pbr.wgsl and the sky ray. VolumetricFogPass prepends screen_ndc.wgsl on both the density and scatter pipelines. sun_above_the_view_is_the_top_of_the_texture locks the CPU helper for a sun that is actually in frame. clip_planes still keeps a 20 km plane. The heavy-scene grid and 64 m terrain sit inside about 46 m of fixed_camera, so step(0.999, depth) (about 83 m at zfar 500) does not treat those models as shaft lights.

Still open

The inline comments cover the off-screen sun, the standalone fog shader, and invariant 22.

Two residuals stay outside this commit. A water pixel left at depth 1 is replaced when aerial copies onto HDR; the heavy scene does not draw water. cloud_raymarching.wgsl still unprojects with uv * 2 - 1, and --clouds is still rejected before a frame.

I did not re-run gated_passes on a GPU. The projection of the test sun is outside the shaft visibility margin, so a green shaft assert would be a later fog step, not a shaft.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread astraweave-render/tests/gated_passes.rs Resolved
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

cursor Bot pushed a commit that referenced this pull request Oct 21, 2026
flag_on treats --name=false and --name false as off, so they do not bail.
The parser and its tests live in budget_gate.rs, under the lib test and
clippy gates. The inventory records #395's atmosphere median and the
SSGI, TAA, and upscale HDR copy blocker.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD 7fcd20b2 fixes the two defects from the previous pass: the shaft sun is inside the visibility margin, and fog_density.wgsl defines screen_uv_to_ndc itself so the standalone parse can resolve the call. PresentationQuality::Measured leaving the pass off is still the right default.

The trace does not match that binary. Invariant 22 still says gpu_frame_budget rejects --atmosphere and prints the baseline median. shaders/screen_ndc.wgsl is not the module either fog pipeline compiles.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG for a pixel. Fog time still advances by a fixed 1/60 per composite. Stars stay a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim. GAME_ZFAR is the same 500.0 the third-person camera already used.
  • Security. No new dependency, no new unsafe (astraweave-render denies it), no discarded Result on the degraded-build bail, no user-supplied shader. flag_on is an exact argv match (--atmosphere or --atmosphere=true). A second gated flag still bails before the device is created. textureLoad of t_sky sits after the workgroup bounds check. The aerial texture is rgba16float with COPY_SRC, and HDR has COPY_DST.
  • The shaft test. At this camera, toward_sun = normalize(0.25, 0.48, -1) projects to UV about (0.716, 0.086), inside (0.55..0.95, 0.02..0.22) and inside the [-0.2, 1.2] margin, with clip.w > 0. The black quad covers pixels y 9..55. The upper march (4 steps, density about 0.75) lands on y 10, 9, 8, 7: the last two are above the quad and above the far red quad (that quad starts near UV y 0.284), so they read the depth clear. step(0.999, 1) is 1. The lower march ends at y 17, still on the quad. Depth at 24 m with far 20 km is about 0.9958, so the quad is not a shaft light. Instance color is black, the default normal is flat, snow and scene fog are 0, and NdotL against this sun is 0, so the quad stays under the luma gate. Fog is off and scatter_geometry is false while shafts are enabled, so the delta is the shaft add. A march that flips texture y relative to that CPU sun fails gain_upper > gain_lower + 8.
  • The froxel formula. screen_uv_to_ndc matches pbr.wgsl. integrate.wgsl samples the volume with the same screen UV (gid.y 0 is the top). The unproject ndc_z matches perspective_rh in [0, 1]. clip_planes still keeps a 20 km plane. Renderer::resize still resizes the pass.

Still open

The inline comments cover invariant 22 and the unused screen module.

Two residuals stay outside this commit. A water pixel left at depth 1 is replaced when aerial copies onto HDR; the heavy scene does not draw water. cloud_raymarching.wgsl still unprojects with uv * 2 - 1, and --clouds is still rejected before a frame. --atmosphere=false is not flag_on, so that token measures the baseline instead of bailing.

I did not re-run gated_passes on a GPU. The projection and the march pixels above are from the same perspective_rh / look_at_rh the test builds.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

Comment thread astraweave-render/tests/gated_passes.rs Resolved
lazyxeon added a commit that referenced this pull request Oct 21, 2026
* docs: inventory built systems that are not on the default path

List the presentation passes, the live owners that must not be duplicated,
and the issues this campaign will not take.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* docs: default presentation passes on when they fit 11 ms

Record the 7.397 ms cloud-march measurement and the estimates scaled
from it. Atmosphere, SSGI, TAA, and depth of field default on. The
raymarch and temporal upscale stay off, with the reason next to the cost.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* docs: measure gated passes before any default-on

7.397 ms is the cloud-shadow amortization, not the raymarch.
gpu_frame_budget can enable atmosphere, SSGI, TAA, DoF, or clouds
one flag at a time and print median_gpu_frame_ms. Defaults stay off
until a GTX 1660 Ti heavy-scene median is at or under 11 ms.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* fix(render): only --atmosphere can fill a budget cell

Reject a second gated flag. Reject SSGI, TAA, upscale, DoF, and the
cloud raymarch before a frame: those paths sample uncleared textures
or never write HDR. --atmosphere replaces SkyRenderer, so its median
is the whole frame. Invariant 22 records that contract.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* docs: name the cfg volumetrics switch and split the shadow rows

aravath.cfg volumetrics=off turns fog and god rays off before the
command-line switches. shadow_csm.rs is the second cascade map.
shadow_quality.rs is the PCSS filter, not another atlas.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* fix(render): reject every gated budget flag

gpu_frame_budget bails before the scene on --atmosphere as well as
--ssgi, --taa, --upscale, --dof, and --clouds. The printed median stays
the baseline frame. Every gated cell stays blank and every gated
default stays off.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* docs: correct the inventory against the current renderer

Fog and god rays belong to #395, not to light_the_world. prepare_frame
on this head still passes a zenith sun, and that gap stays with #395.
The last matching aravath.cfg key wins. DoF writes AdvancedPostFx's
"TAA History" texture, which is not TaaPass history, so both defaults
stay off. Invariant 22 was re-read at 85ad478.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* fix(render): rebase the inventory onto main and test the flag gate

The trace keeps main's v1.48 Hi-Z wording and adds the gated-flag
reject sentence on the timestamp row. last_verified_commit is
83798b4. #395 owns the clear, the sky sample, and the sun. Fog and
god rays stay light_the_world callers. flag_on accepts a bare flag,
=true, and a two-token true, and the SSGI, TAA, and upscale errors
name the uncopied history images.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* fix(render): parse gated false flags in the lib gate

flag_on treats --name=false and --name false as off, so they do not bail.
The parser and its tests live in budget_gate.rs, under the lib test and
clippy gates. The inventory records #395's atmosphere median and the
SSGI, TAA, and upscale HDR copy blocker.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

* fix(render): name the uncopied SSGI, TAA, and upscale views

The reject reasons still cite the unwritten inputs and history samples,
and now also say each pass writes its own view and that view is never
copied onto hdr_tex.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Base automatically changed from cursor/wiring-campaign-inventory-568b to main October 21, 2026 11:11
cursoragent and others added 5 commits October 21, 2026 11:14
Sky-depth pixels load the Bruneton sky instead of the empty scene color.
Aravath calls set_atmosphere_enabled(true). The estimate against the
3.688 ms heavy scene is about 1 ms, under the 11 ms limit.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
The runtime caller reads PresentationQuality, whose default leaves the
flag off. Sky-depth pixels still load the Bruneton sky when a caller
enables the pass. No default-on from the 1 ms estimate.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Aerial treats only a cleared depth of 1 as sky. The ray uses the inverse
view-projection, the scene sun, and the camera clip planes. draw_into
clears HDR and depth when Bruneton replaces SkyRenderer. The runtime
flag follows PresentationQuality, and a headless frame checks sky
against near and far geometry.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
--atmosphere is the one gated flag. It clears HDR and depth, samples
the Bruneton sky, and draws Aravath's fog and god rays without a second
scatter. clip_planes keeps a 20 km far plane, and the pass resizes with
the window. The sky pixel test rejects the debug magenta clear.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
Bruneton copies onto HDR before volumetric fog and god rays, so a
cleared pixel keeps both. The sky pixel test enables those passes.
A failed fog or shaft build prints the degraded mode and exits before
a median instead of claiming atmosphere_with_aravath_fog.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
cursoragent and others added 3 commits October 21, 2026 11:16
Fog froxels and the shaft sun follow the sky and pbr mapping:
ndc.y = 1 - 2*uv.y, uv.y = 0.5 - 0.5*ndc.y. The pixel test samples
an upper sky row and a lower ground row with an off-center sun, so a
mirrored composite fails. The budget camera far plane is GAME_ZFAR.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
The pixel test puts the sun in the upper-right shaft margin and reads a
black quad just under it, with fog off. That row brightens, the shaft
texel is not black, and the y-mirrored row does not. fog_density.wgsl
and scatter.wgsl define screen_uv_to_ndc themselves so the standalone
naga parse resolves the call. The timestamp row is unchanged.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
The atmosphere budget calls budget_gate::flag_on, so --atmosphere false
is off. record_bruneton uses the light direction, or the time-of-day sun
when that vector is empty, and the game camera publishes GAME_ZNEAR with
GAME_ZFAR. Invariant 22 keeps main's Hi-Z and false-flag sentences and
records the --atmosphere measurement.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/wire-atmosphere-568b branch from 7fcd20b to 8d6e986 Compare October 21, 2026 11:21
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD 8d6e9867 fixes the timestamp contract: invariant 22 and the v1.51 notice now say --atmosphere alone measures atmosphere_with_aravath_fog, and a failed fog or shaft build exits before a median. PresentationQuality::Measured leaving the pass off is still the right default. There is no GTX 1660 Ti median on this head.

The live command and the tested gate are not the same function. docs/current/WIRING_CAMPAIGN.md still describes the pre-change call. Two earlier threads are still open: shaders/screen_ndc.wgsl has no includer, and the shaft pixel test never runs fog_density.wgsl.

What holds

  • Sim determinism. The diff is presentation-only. It does not write ECS, save, or replay state, and it does not sample a wall clock or an unseeded RNG for a pixel. Fog time still advances by a fixed 1/60 per composite. Stars stay a hash of the view ray. The nineteen cross-OS replay cases stay on the CPU sim. The atmosphere bench sets current_time = 16.4 and time_scale = 0 before update_view, so the sampled sun is frozen. At 16.4, get_sun_position().y is about 0.41, get_light_direction() is the negation, and record_bruneton negates that again, so the Bruneton sun is the time-of-day sun. GAME_ZFAR is the same 500.0 the third-person camera already used.
  • Security. No new dependency (astraweave-render already depends on astraweave-camera). No new unsafe. No discarded Result on the degraded-build bail. No user-supplied shader. flag_on is an exact argv match. A second enabled gated flag still bails before Renderer::new. textureLoad of t_sky sits after the workgroup bounds check. Binding 6 is Float { filterable: false } on the rgba16float sky target. The sky storage write and the aerial sample are separate compute passes. The aerial texture and HDR are both Rgba16Float, and HDR has COPY_DST.
  • The composite. draw_into clears HDR and depth, the main pass loads both, record_bruneton copies the sky onto HDR, then fog and shafts composite. With either pass enabled, scatter_geometry is false, so geometry is one scatter. Cleared pixels (depth == 1) keep the fog and shafts that run afterward. Renderer::resize resizes the pass. clip_planes still keeps a 20 km plane.

Still open

The inline comments cover the forked flag gate and the campaign inventory.

shaders/screen_ndc.wgsl is still unused. VolumetricFogPass compiles the copies inside fog_density.wgsl and scatter.wgsl. §5 does not list the file. The shaft frame in gated_passes.rs still forces fog off, so a flipped ndc.y in the froxel shader still passes that test.

Two residuals stay outside this commit. A water pixel left at depth 1 is replaced when aerial copies onto HDR; run_water_pass draws with read-only depth before record_bruneton, and the heavy scene does not draw water. cloud_raymarching.wgsl still unprojects with uv * 2 - 1, and --clouds is still rejected before a frame. god_rays.wgsl still treats raw depth ≥ 0.999 as a light (about 83 m at GAME_ZFAR). The heavy grid ends near 46 m, so that cutoff does not light the bench models.

I did not re-run gated_passes on a GPU. The 16.4 sun sign and the 83 m shaft cutoff are from the same get_sun_position and perspective_rh this head builds.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

reject_gated_flags accepts --atmosphere alone and describes the HDR
clear. The bin calls that function. The campaign doc names
record_bruneton. screen_ndc.wgsl is deleted, and height fog on the
shaft rows fails if fog_density flips ndc.y.

Co-authored-by: Andrew Brown <lazyxeon@users.noreply.github.com>
@cursor

cursor Bot commented Oct 21, 2026

Copy link
Copy Markdown

@coderabbitai review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict

Keep Bruneton off. HEAD 3eacf8a9 puts the budget gate in one function: reject_gated_flags accepts --atmosphere alone, rejects every other enabled gated flag, and gpu_frame_budget calls it. The unused screen_ndc.wgsl is deleted, and the new height-fog sample locks fog_density.wgsl. PresentationQuality::Measured leaving the pass off is still the right default. There is no GTX 1660 Ti median on this head.

scatter.wgsl still has its own screen_uv_to_ndc. The new assert stays green if that copy is mirrored, because ambient in-scatter follows the density written by fog_density.wgsl. The wiring order list tells the next pass that record_bruneton uses the time-of-day sun and clip_planes(GAME_ZNEAR, GAME_ZFAR). The call passes -light_dir when that vector is non-empty, and clip_planes of the bound projection.

Checked on this head: no new dependency, no new unsafe, no simulation write, replay inputs untouched. flag_on still treats bare, =true, and true as on, and =false and false as off. With Bruneton on, draw_into still clears HDR and depth and the main pass loads both. Gate (fmt, clippy, check), cargo-deny, cargo-audit, and the macOS replay hash passed. The Ubuntu affected test was still pending, so this review did not see the new lavapipe pixel assert run.

Open in Web View Automation 

Sent by Cursor Automation: ASTRA PR AUDIT AGENT

// ---- Froxel → world position (same exponential distribution as density pass) ----
// uv.y 0 is the top of the texture. NDC y is +1 there. Same pair as pbr.wgsl.

fn screen_uv_to_ndc(uv: vec2<f32>) -> vec2<f32> {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

screen_uv_to_ndc here is a second copy of the function in fog_density.wgsl. The new pixel assert does not read this copy.

integrate.wgsl samples the scatter volume with the screen UV as the froxel xy. The density in that voxel was written by fog_density.wgsl. scatter_main multiplies that density by the phase and the shadow, and it also adds ambient_color * density * 0.25, which does not use world_pos. A mirrored ndc.y in this file moves the phase and the shadow sample. The ambient term still follows fog_density.wgsl, so fog_lower > fog_upper + 8 still passes.

The two functions match today (ndc.y = 1 - 2*uv.y). Nothing compares the source. ndc_to_screen_uv in god_rays.rs is the CPU pair and does not compile this shader. A source compare of the two WGSL functions would fail a mirrored copy without a device.

## Order

1. This inventory. `gpu_frame_budget` rejects an enabled gated flag, including `--atmosphere`. `--flag false` is off. Every gated cell on this binary stays blank. #395 prints `atmosphere_with_aravath_fog` only when both fog and shafts build; otherwise it bails and there is no median. Defaults stay off.
1. This inventory. `gpu_frame_budget` accepts `--atmosphere` alone. `--flag false` is off. The run prints `atmosphere_with_aravath_fog` only when both fog and shafts build; otherwise it bails and there is no median. `record_bruneton` uses the time-of-day sun and `clip_planes(GAME_ZNEAR, GAME_ZFAR)`. Defaults stay off.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence names a call that is not in record_bruneton.

The sun is -light_dir when light_dir_pad is non-empty. get_sun_position() runs only when that vector is empty. The bench writes current_time = 16.4 and time_scale = 0 before update_view. With no light override, get_light_direction() at 16.4 is -get_sun_position(), so the double negation is the afternoon sun. A light override, which the pixel test sets, replaces that sun. The planes are clip_planes(cached_proj). That function takes the matrix. GAME_ZNEAR / GAME_ZFAR (0.1 / 500) are what fixed_camera and ThirdPersonCamera pass to perspective. The headless atmosphere test uses far 20_000, and clip_planes recovers that far. Feeding the two constants into the prepare call would put 500 back on that camera.

ATMOSPHERE_REASON says "copies the time-of-day sun", and the lib test does not check that phrase. The atmosphere row above ("clip_planes of the bound camera") matches the code. This order line should say the same thing.

@lazyxeon
lazyxeon marked this pull request as ready for review October 21, 2026 14:42
@lazyxeon
lazyxeon merged commit 040f24a into main Oct 21, 2026
36 checks passed
@lazyxeon
lazyxeon deleted the cursor/wire-atmosphere-568b branch October 21, 2026 14:42
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T14:56:46.071840Z 3eacf8a Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3eacf8a9ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +104 to +106
if (depth_raw == 1.0) {
let sky = textureLoad(t_sky, pixel, 0);
textureStore(t_output, pixel, vec4<f32>(sky.rgb, 1.0));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve transparent water when replacing sky pixels

When atmosphere is enabled and water is visible over the far-plane clear, this branch replaces the already-rendered water with t_sky. renderer.rs:8067-8077 records run_water_pass before Bruneton, while water.rs:584 disables water depth writes, so those water pixels still have depth 1.0; the previous shader preserved scene_color for them. Record Bruneton before transparent water/overlays or otherwise preserve their color.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants