[pr-fix][rendering][lighting] Reflections: the rays' image filled with the light around (DARNER_AMBIENT_SPECULAR_FILL=1, off by default) #17

Open
Jesper-A wants to merge 2 commits from Jesper-A/Darner:pr6-specular-fill into main
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

Re-filed from an earlier CodeFloe PR (that repo is gone; nothing was migrated). Same branch and commit.

Base: the branch (2 commits) is on 4db98e011, the main commit it was cut from. main is now 4a92569fb. Not rebased (WIP; we rebase before WIP comes off, or sooner if you ask). A text-only trial merge (git merge-tree --write-tree --name-only trustno1/main pr6-specular-fill) conflicts in crates/darner-gpu/src/ambient.rs only; README.md and draw.rs merge cleanly. The conflict comes from the "Guard ambient lighting until GPU estimates are ready" change (merged into main as 3b7b6c6e9; the commit is a080db6bb): in without_depth it removed the || !KEPT.load(...) part of if !bound_asked() || !KEPT.load(...), the same line this branch extends to bound_asked() || fill_asked(). When this is rebased, the resolution is if !(bound_asked() || fill_asked()), without bringing KEPT back.

This is a draft. It has not been run in the game by us on any base. Two clippy gates and the policy check passed; the workspace test run was not done (see below).

What this is about. With the reflection estimate on (DARNER_AMBIENT_SPECULAR), the rays' image of the reflections is written in tiles, and only the miss program writes the tiles of rays that found nothing. When that program is left out (opaque surfaces; on current main that is ray tracing off), those tiles keep bytes of earlier frames: pieces of the picture from other views and black blocks. Glossy surfaces read them as a shimmer that moves with the camera (a fork author's frame capture: a blue bucket, blinds, a counter; 2026-11-28). The estimate along the reflected direction makes its normals from the depth and is itself the grain on floors seen at a grazing angle.

New switch: DARNER_AMBIENT_SPECULAR_FILL=1. Default: not set (off), nothing changes. It acts only with DARNER_AMBIENT_SPECULAR set, which is off in darner play's defaults, so by default it changes nothing for anyone. With both on:

  • every dispatch of the miss program for opaque and transparent surfaces is followed by the existing depth-less pass (ambient::without_depth), which gives every texel of the rays' image the light around, without a direction, in place of the estimate along the reflected direction. That light has no direction and no texel of its own, so nothing is left to be ragged;
  • the opaque layer's program, left out otherwise, runs, so the tiles only it writes are written in every frame.

Notes:

  • Stands alone. The check ambient::fill_asked() includes DARNER_AMBIENT_SPECULAR itself, so this needs no other pull request. The opaque program runs only when ambient::on(Role::Miss) is also true (the sky_miss_left_out check is rays_found() || (fill_asked() && on(Role::Miss))). It is related to #14: that change makes the opaque program run under the estimate, which is the same as this change's "program runs" half, so with both merged that half is redundant. #14 does not do the fill, and the fill works without the program part.
  • Ray tracing off, and on. The opaque program is left out only with ray tracing off, so the part that makes it run again changes something only there. The fill itself is not limited that way: in draw.rs its early return for the miss role runs whenever the switch is on, without checking whether rays were found, so it also acts with ray tracing on (opaque and transparent layers; water is left out by the layer check). That case is untested.
  • It applies only when DARNER_RAYMISS_KEEP is not set; KEEP keeps its meaning.
  • Water's dispatches stay as they are. without_depth was so far reachable only with DARNER_AMBIENT_SPECULAR_BOUND=1; its condition becomes "bound asked or fill asked". Read once (asked_for! in ambient::fill_asked). No shader change of the title, so the shader cache key is unchanged.
  • Also: a README row (Lighting and ray tracing) and a docs/findings.md entry.

Diff against 4db98e011: 4 files (README.md, crates/darner-gpu/src/ambient.rs, crates/darner-gpu/src/draw.rs, docs/findings.md), 2 commits.

Credit: a port of the fill in advxrsary's commit dd8979582 (shown as author "advx") in a fork of the project's earlier GitHub repository (a pull request there; that repository is gone, so there is no link). There it was on by default. The same commit also capped a window's share of the room's light in the diffuse stand-in; that is not ported (it changes a default path and would need its own switch and test). The commit message carries a Co-authored-by line.

Related earlier reports on CodeFloe (not migrated): lighting jumps with ray tracing off (#82 there), reflections picking up texture colours (#140), and reflection ghosting (#251). They are related, not claimed fixed, so there is no Fixes or Refs line.

Spec dependence

  • Likely general: host-side passes that already exist, no title shader, no wave-size dependence.
  • May depend on our setup (RTX 2070 SUPER 8 GB Turing, ReBAR off, Ryzen 7 5800X, 32 GB, Series S + DLSS Performance): nothing known, but we have not run it.
  • Untested elsewhere: everything, including the fill with ray tracing on. It also needs DARNER_AMBIENT_SPECULAR on, a setting we do not use by default.

How it was tested

  • Tested revision: a55cf8a12 (branch pr6-specular-fill, based on 4db98e011; main has moved, see Base).
  • Commands and results (all on a55cf8a12):
    • cargo clippy --workspace --all-targets --locked -- -D warnings: passed, without any -A flag.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passed, without any -A flag.
    • cargo test -p darner-gpu --locked --lib -- --test-threads 1: 1670 passed, 1 failed: watch::tests::ask_once_by_res_splits_reservations_without_refusals (left Some(125854), right None). It passed when run again alone. We call it unconfirmed flaky: we did not run main for comparison. This is not the required gate; cargo test --workspace --locked was not run. This change adds no unit test of its own.
    • cargo xtask policy: passed.
    • There is no CI upstream; nothing here was checked by CI.
  • Gameplay, when relevant: not run by us with this switch on. The evidence is the fork author's own capture described above, not repeated here.
  • Before and after, when relevant: none.
  • Shader wave sizes tested, when relevant: not relevant (no shader change of the title; the host pass it reuses already exists).
  • Coverage gaps: cargo test --workspace --locked; the one failed test above not checked against main; everything in the game; the cost (one small pass per dispatch, not measured); whether the fill looks right next to the estimate in the other (non-fill) parts of the picture; AMD and wave64 cards; Series X profile; the branch on current main (it conflicts in ambient.rs).

Checklist

  • This PR contains one change based on main. (git diff --stat 4db98e011 a55cf8a12: the 4 files above, one change. The branch is on 4db98e011, not on current main; a trial merge conflicts in ambient.rs, see Base. The workspace test gate was not run.)
  • The diff follows docs/asset-policy.md. (Text only; cargo xtask policy passed on a55cf8a12.)
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for the same change. On 2026-12-03 this host had 4 issues (#1, #2, #4, #13) and 12 pull requests (#3 by another contributor; #5 to #12 and #14 to #16 ours, WIP) in total; I searched their titles and bodies for raymiss, miss program, specular and reflection: nothing. The other contributor's pull request (#3, ray tracing mode in F1) changes host/menu.rs, host/panel.rs and hwrt.rs: none of this change's files. The ambient-guard change that now conflicts (3b7b6c6e9) is already in main; it also edits ambient.rs, so this branch needs a rebase there. Our sibling branches: #14 (DARNER_RAYMISS_ESTIMATED; edits sky_miss_left_out and ambient.rs; textual conflict in one closure; its change is the same as this one's "program runs" half, so whichever merges second needs a rebase), pr6-raymiss-clear (DARNER_RAYMISS_CLEAR, may also conflict textually in sky_miss_left_out) and pr6-air-room (edits ambient.rs and the same README table).
  • Our own re-filed PRs that touch the same files: #6 (README.md, docs/findings.md); #7 (docs/findings.md); #8 (README.md, docs/findings.md); #9 (README.md, docs/findings.md); #10 (README.md, docs/findings.md); #11 (README.md); #12 (README.md, docs/findings.md); #14 (README.md, crates/darner-gpu/src/ambient.rs, crates/darner-gpu/src/draw.rs, docs/findings.md); #15 (README.md, crates/darner-gpu/src/draw.rs, docs/findings.md); #16 (README.md, docs/findings.md). #5 share no file. Different changes; whichever lands first, the others take its rows when they are rebased.

Update 2026-12-03: marked ready as it stands; the 'draft' and 'not rebased' wording above is out of date, nothing was re-run in the game, and the maintainer will handle the rebase.

This change was made with AI assistance (Claude Code).

## Contributor role (optional) - Fluxer ID: ## What it changes Re-filed from an earlier CodeFloe PR (that repo is gone; nothing was migrated). Same branch and commit. **Base:** the branch (2 commits) is on `4db98e011`, the `main` commit it was cut from. `main` is now `4a92569fb`. Not rebased (WIP; we rebase before WIP comes off, or sooner if you ask). A text-only trial merge (`git merge-tree --write-tree --name-only trustno1/main pr6-specular-fill`) **conflicts** in `crates/darner-gpu/src/ambient.rs` only; `README.md` and `draw.rs` merge cleanly. The conflict comes from the "Guard ambient lighting until GPU estimates are ready" change (merged into `main` as `3b7b6c6e9`; the commit is `a080db6bb`): in `without_depth` it removed the `|| !KEPT.load(...)` part of `if !bound_asked() || !KEPT.load(...)`, the same line this branch extends to `bound_asked() || fill_asked()`. When this is rebased, the resolution is `if !(bound_asked() || fill_asked())`, without bringing `KEPT` back. This is a draft. It has not been run in the game by us on any base. Two clippy gates and the policy check passed; the workspace test run was not done (see below). **What this is about.** With the reflection estimate on (`DARNER_AMBIENT_SPECULAR`), the rays' image of the reflections is written in tiles, and only the miss program writes the tiles of rays that found nothing. When that program is left out (opaque surfaces; on current `main` that is ray tracing off), those tiles keep bytes of earlier frames: pieces of the picture from other views and black blocks. Glossy surfaces read them as a shimmer that moves with the camera (a fork author's frame capture: a blue bucket, blinds, a counter; 2026-11-28). The estimate along the reflected direction makes its normals from the depth and is itself the grain on floors seen at a grazing angle. **New switch: `DARNER_AMBIENT_SPECULAR_FILL=1`.** Default: not set (off), nothing changes. It acts only with `DARNER_AMBIENT_SPECULAR` set, which is off in `darner play`'s defaults, so by default it changes nothing for anyone. With both on: - every dispatch of the miss program for opaque and transparent surfaces is followed by the existing depth-less pass (`ambient::without_depth`), which gives every texel of the rays' image the light around, without a direction, in place of the estimate along the reflected direction. That light has no direction and no texel of its own, so nothing is left to be ragged; - the opaque layer's program, left out otherwise, runs, so the tiles only it writes are written in every frame. Notes: - **Stands alone.** The check `ambient::fill_asked()` includes `DARNER_AMBIENT_SPECULAR` itself, so this needs no other pull request. The opaque program runs only when `ambient::on(Role::Miss)` is also true (the `sky_miss_left_out` check is `rays_found() || (fill_asked() && on(Role::Miss))`). It is related to `#14`: that change makes the opaque program run under the estimate, which is the same as this change's "program runs" half, so with both merged that half is redundant. `#14` does not do the fill, and the fill works without the program part. - **Ray tracing off, and on.** The opaque program is left out only with ray tracing off, so the part that makes it run again changes something only there. The fill itself is not limited that way: in `draw.rs` its early return for the miss role runs whenever the switch is on, without checking whether rays were found, so it also acts with ray tracing on (opaque and transparent layers; water is left out by the layer check). That case is untested. - It applies only when `DARNER_RAYMISS_KEEP` is not set; `KEEP` keeps its meaning. - Water's dispatches stay as they are. `without_depth` was so far reachable only with `DARNER_AMBIENT_SPECULAR_BOUND=1`; its condition becomes "bound asked or fill asked". Read once (`asked_for!` in `ambient::fill_asked`). No shader change of the title, so the shader cache key is unchanged. - Also: a README row (Lighting and ray tracing) and a `docs/findings.md` entry. Diff against `4db98e011`: 4 files (`README.md`, `crates/darner-gpu/src/ambient.rs`, `crates/darner-gpu/src/draw.rs`, `docs/findings.md`), 2 commits. **Credit:** a port of the fill in **advxrsary**'s commit `dd8979582` (shown as author "advx") in a fork of the project's earlier GitHub repository (a pull request there; that repository is gone, so there is no link). There it was on by default. The same commit also capped a window's share of the room's light in the diffuse stand-in; that is **not** ported (it changes a default path and would need its own switch and test). The commit message carries a `Co-authored-by` line. Related earlier reports on CodeFloe (not migrated): lighting jumps with ray tracing off (#82 there), reflections picking up texture colours (#140), and reflection ghosting (#251). They are related, not claimed fixed, so there is no `Fixes` or `Refs` line. ### Spec dependence - **Likely general:** host-side passes that already exist, no title shader, no wave-size dependence. - **May depend on our setup** (RTX 2070 SUPER 8 GB Turing, ReBAR off, Ryzen 7 5800X, 32 GB, Series S + DLSS Performance): nothing known, but we have not run it. - **Untested elsewhere:** everything, including the fill with ray tracing on. It also needs `DARNER_AMBIENT_SPECULAR` on, a setting we do not use by default. ## How it was tested - Tested revision: `a55cf8a12` (branch `pr6-specular-fill`, based on `4db98e011`; `main` has moved, see Base). - Commands and results (all on `a55cf8a12`): - `cargo clippy --workspace --all-targets --locked -- -D warnings`: passed, without any `-A` flag. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: passed, without any `-A` flag. - `cargo test -p darner-gpu --locked --lib -- --test-threads 1`: 1670 passed, 1 failed: `watch::tests::ask_once_by_res_splits_reservations_without_refusals` (left `Some(125854)`, right `None`). It passed when run again alone. We call it unconfirmed flaky: we did not run `main` for comparison. This is not the required gate; **`cargo test --workspace --locked` was not run.** This change adds no unit test of its own. - `cargo xtask policy`: passed. - There is no CI upstream; nothing here was checked by CI. - Gameplay, when relevant: not run by us with this switch on. The evidence is the fork author's own capture described above, not repeated here. - Before and after, when relevant: none. - Shader wave sizes tested, when relevant: not relevant (no shader change of the title; the host pass it reuses already exists). - Coverage gaps: `cargo test --workspace --locked`; the one failed test above not checked against `main`; everything in the game; the cost (one small pass per dispatch, not measured); whether the fill looks right next to the estimate in the other (non-fill) parts of the picture; AMD and wave64 cards; Series X profile; the branch on current `main` (it conflicts in `ambient.rs`). ## Checklist - [x] This PR contains one change based on `main`. (`git diff --stat 4db98e011 a55cf8a12`: the 4 files above, one change. The branch is on `4db98e011`, not on current `main`; a trial merge conflicts in `ambient.rs`, see Base. The workspace test gate was not run.) - [x] The diff follows `docs/asset-policy.md`. (Text only; `cargo xtask policy` passed on `a55cf8a12`.) - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for the same change. On 2026-12-03 this host had 4 issues (#1, #2, #4, #13) and 12 pull requests (#3 by another contributor; #5 to #12 and #14 to #16 ours, WIP) in total; I searched their titles and bodies for raymiss, miss program, specular and reflection: nothing. The other contributor's pull request (#3, ray tracing mode in F1) changes `host/menu.rs`, `host/panel.rs` and `hwrt.rs`: none of this change's files. The ambient-guard change that now conflicts (`3b7b6c6e9`) is already in `main`; it also edits `ambient.rs`, so this branch needs a rebase there. Our sibling branches: `#14` (`DARNER_RAYMISS_ESTIMATED`; edits `sky_miss_left_out` and `ambient.rs`; textual conflict in one closure; its change is the same as this one's "program runs" half, so whichever merges second needs a rebase), `pr6-raymiss-clear` (`DARNER_RAYMISS_CLEAR`, may also conflict textually in `sky_miss_left_out`) and `pr6-air-room` (edits `ambient.rs` and the same README table). - Our own re-filed PRs that touch the same files: #6 (`README.md`, `docs/findings.md`); #7 (`docs/findings.md`); #8 (`README.md`, `docs/findings.md`); #9 (`README.md`, `docs/findings.md`); #10 (`README.md`, `docs/findings.md`); #11 (`README.md`); #12 (`README.md`, `docs/findings.md`); #14 (`README.md`, `crates/darner-gpu/src/ambient.rs`, `crates/darner-gpu/src/draw.rs`, `docs/findings.md`); #15 (`README.md`, `crates/darner-gpu/src/draw.rs`, `docs/findings.md`); #16 (`README.md`, `docs/findings.md`). #5 share no file. Different changes; whichever lands first, the others take its rows when they are rebased. Update 2026-12-03: marked ready as it stands; the 'draft' and 'not rebased' wording above is out of date, nothing was re-run in the game, and the maintainer will handle the rebase. This change was made with AI assistance (Claude Code).
With the reflection stand-in on, every dispatch of the miss program for opaque
and transparent surfaces is followed by the existing depth-less pass
(ambient::without_depth), which gives every texel of the rays' image the
light around, without a direction; and the opaque layer's program runs.
Left out, the tiles only it writes kept earlier frames' bytes, a shimmer that
moves with the camera on glossy surfaces (advxrsary's capture).

Port of the fill in advxrsary's fork commit dd8979582 (old PR #4347; on by
default there). Its cap on a window's share of the room's light in the
diffuse stand-in is not ported. No shader change of the title.

Co-authored-by: advxrsary <[email protected]>

This change was made with AI assistance (Claude Code).
The row and the findings entry for the commit before (port of the fill in advxrsary's fork commit dd8979582).

This change was made with AI assistance (Claude Code).
Jesper-A changed title from WIP: [pr-fix][rendering][lighting] Reflections: the rays' image filled with the light around (DARNER_AMBIENT_SPECULAR_FILL=1, off by default) to [pr-fix][rendering][lighting] Reflections: the rays' image filled with the light around (DARNER_AMBIENT_SPECULAR_FILL=1, off by default) 2026-12-03 18:30:01 +00:00
This pull request has changes conflicting with the target branch.
  • crates/darner-gpu/src/ambient.rs
  • docs/findings.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr6-specular-fill:Jesper-A-pr6-specular-fill'
git switch 'Jesper-A-pr6-specular-fill'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'Jesper-A-pr6-specular-fill'
git switch 'Jesper-A-pr6-specular-fill'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-specular-fill'
git switch 'Jesper-A-pr6-specular-fill'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Jesper-A-pr6-specular-fill'
git switch 'main'
git merge --squash 'Jesper-A-pr6-specular-fill'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-specular-fill'
git switch 'main'
git merge 'Jesper-A-pr6-specular-fill'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner!17
No description provided.