[pr-fix][rendering][lighting] Reflections: the opaque miss program runs under the reflection estimate (DARNER_RAYMISS_ESTIMATED=1, off by default) #14

Open
Jesper-A wants to merge 2 commits from Jesper-A/Darner:pr6-raymiss-estimated 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-raymiss-estimated) merges cleanly: no conflicts.

This is a draft. It has not been run in the game by us on any base.

What this is about. The reflections' "missed everything" program (the miss program) is left out for opaque surfaces when the title's rays find nothing to hit, which on current main means ray tracing off (sky_miss_left_out in draw.rs; an earlier CodeFloe PR, #309 there, not migrated, made it run when rays are found; that change is in main). It is left out for the sky light it gives each ray: a white grain on floors seen at a grazing angle. Leaving it out has a cost: the texels no screen-space pass resolves keep earlier frames' bytes, and the reflections feed them back frame after frame (the half-size reflection image is resolved from the frame before). A fork's frame capture showed colour noise over a convex mirror and glowing blue patches on a cell floor from that, and its run with the program kept had a clean mirror, floor and glass.

With the reflection estimate on (DARNER_AMBIENT_SPECULAR), the sky light the program gives is replaced by the estimate along the reflected direction, so the cause of the grain is gone, and there is less reason to leave the program out.

New switch: DARNER_RAYMISS_ESTIMATED=1. Default: not set (off), nothing changes. With 1 and DARNER_AMBIENT_SPECULAR set, the opaque layer's dispatches of the miss program run while the reflection estimate follows them. Without DARNER_AMBIENT_SPECULAR it does nothing. DARNER_AMBIENT_SPECULAR is off in darner play's defaults, so by default this switch changes nothing for anyone.

  • Ray tracing off only. The program is left out only with ray tracing off, so this switch changes something only there. This change stands alone on main: it needs no other pull request.
  • It applies only when DARNER_RAYMISS_KEEP is not set. KEEP keeps its meaning and wins when set.
  • The check is the new ambient::specular_on() (is DARNER_AMBIENT_SPECULAR set) together with ambient::on(Role::Miss). The original asked only the second, which DARNER_AMBIENT alone also makes true; that would have turned it on for people without the reflection estimate.
  • The decision is a pure function, miss_left_out(keep, estimated), with a unit test (miss_tests). Read once (asked_for!). No shader change, 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 BaRian29's commit 5c212d21b 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 whenever the estimate was. The commit message carries a Co-authored-by line.

No upstream issue covers this, so there is no Fixes or Refs line.

Spec dependence

  • Likely general: the change is a yes/no decision on the CPU side, no shader change.
  • 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. It also needs DARNER_AMBIENT_SPECULAR on, a setting we do not use by default, and ray tracing off.

How it was tested

  • Tested revision: e8f3642db (branch pr6-raymiss-estimated, based on 4db98e011; main has moved, see Base).
  • Commands and results:
    • cargo clippy --workspace --all-targets --locked -- -D warnings with -A clippy::unnecessary_lazy_evaluations added: passed. The exact command without that flag was not run.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, the same flag added: passed.
    • Tests: darner-gpu, full library: one test failed, watch::tests::ask_once_by_res_splits_reservations_without_refusals (once also watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs). It is in a test file this change does not touch and it passes when run alone. We did not run main for comparison, so we do not know whether it is flaky or an old failure. cargo test --workspace --locked as one command was not run. The new miss_tests are part of the darner-gpu library tests.
    • 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 at 1 and the estimate on. In our play sessions of 2026-12-02 the switch was set to 1 only while the estimate was off (where it does nothing), or was 0 while the estimate was on. The only evidence for this behaviour is the fork author's own capture described above (RTX 4070 Ti SUPER, Series S, 2026-11-29), which we did not repeat.
  • Before and after, when relevant: none.
  • Shader wave sizes tested, when relevant: not relevant (no shader change).
  • Coverage gaps: everything in the game; the reappearance of the white grain on floors with the estimate on (the claim that the estimate removes its cause is the fork author's, not ours); the cost; the estimate itself is off by default and has its own known colour problems, which this does not touch.

Checklist

  • This PR contains one change based on main. (git diff --stat 4db98e011 e8f3642db: the 4 files above. The branch is on 4db98e011, not on current main; a trial merge is clean, see Base.)
  • The diff follows docs/asset-policy.md. (Text only; cargo xtask policy passed.)
  • 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 3 issues (#1, #2, #4) and 8 pull requests (#3 by another contributor; #5 to #11 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. Our sibling branches pr6-raymiss-clear (DARNER_RAYMISS_CLEAR) and pr6-specular-fill (DARNER_AMBIENT_SPECULAR_FILL) also edit sky_miss_left_out, and with pr6-air-room all add a row and bump the setting count in the README's "Lighting and ray tracing" table. The fill branch and this one conflict textually in one closure of sky_miss_left_out if both merge. Earlier reports on CodeFloe (not migrated) about lighting jumps with ray tracing off, reflections picking up texture colours and reflection ghosting are related, not claimed fixed.
  • 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). #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-raymiss-estimated`) merges **cleanly**: no conflicts. This is a draft. It has not been run in the game by us on any base. **What this is about.** The reflections' "missed everything" program (the miss program) is left out for opaque surfaces when the title's rays find nothing to hit, which on current `main` means ray tracing off (`sky_miss_left_out` in `draw.rs`; an earlier CodeFloe PR, #309 there, not migrated, made it run when rays are found; that change is in `main`). It is left out for the sky light it gives each ray: a white grain on floors seen at a grazing angle. Leaving it out has a cost: the texels no screen-space pass resolves keep earlier frames' bytes, and the reflections feed them back frame after frame (the half-size reflection image is resolved from the frame before). A fork's frame capture showed colour noise over a convex mirror and glowing blue patches on a cell floor from that, and its run with the program kept had a clean mirror, floor and glass. With the reflection estimate on (`DARNER_AMBIENT_SPECULAR`), the sky light the program gives is replaced by the estimate along the reflected direction, so the cause of the grain is gone, and there is less reason to leave the program out. **New switch: `DARNER_RAYMISS_ESTIMATED=1`.** Default: not set (off), nothing changes. With `1` and `DARNER_AMBIENT_SPECULAR` set, the opaque layer's dispatches of the miss program run while the reflection estimate follows them. Without `DARNER_AMBIENT_SPECULAR` it does nothing. `DARNER_AMBIENT_SPECULAR` is off in `darner play`'s defaults, so by default this switch changes nothing for anyone. - **Ray tracing off only.** The program is left out only with ray tracing off, so this switch changes something only there. This change stands alone on `main`: it needs no other pull request. - It applies only when `DARNER_RAYMISS_KEEP` is not set. `KEEP` keeps its meaning and wins when set. - The check is the new `ambient::specular_on()` (is `DARNER_AMBIENT_SPECULAR` set) together with `ambient::on(Role::Miss)`. The original asked only the second, which `DARNER_AMBIENT` alone also makes true; that would have turned it on for people without the reflection estimate. - The decision is a pure function, `miss_left_out(keep, estimated)`, with a unit test (`miss_tests`). Read once (`asked_for!`). No shader change, 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 **BaRian29**'s commit `5c212d21b` 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 whenever the estimate was. The commit message carries a `Co-authored-by` line. No upstream issue covers this, so there is no `Fixes` or `Refs` line. ### Spec dependence - **Likely general:** the change is a yes/no decision on the CPU side, no shader change. - **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. It also needs `DARNER_AMBIENT_SPECULAR` on, a setting we do not use by default, and ray tracing off. ## How it was tested - Tested revision: `e8f3642db` (branch `pr6-raymiss-estimated`, based on `4db98e011`; `main` has moved, see Base). - Commands and results: - `cargo clippy --workspace --all-targets --locked -- -D warnings` with `-A clippy::unnecessary_lazy_evaluations` added: passed. The exact command without that flag was not run. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, the same flag added: passed. - Tests: `darner-gpu`, full library: one test failed, `watch::tests::ask_once_by_res_splits_reservations_without_refusals` (once also `watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs`). It is in a test file this change does not touch and it passes when run alone. We did not run `main` for comparison, so we do not know whether it is flaky or an old failure. `cargo test --workspace --locked` as one command was not run. The new `miss_tests` are part of the `darner-gpu` library tests. - `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 at 1 and the estimate on. In our play sessions of 2026-12-02 the switch was set to 1 only while the estimate was off (where it does nothing), or was 0 while the estimate was on. The only evidence for this behaviour is the fork author's own capture described above (RTX 4070 Ti SUPER, Series S, 2026-11-29), which we did not repeat. - Before and after, when relevant: none. - Shader wave sizes tested, when relevant: not relevant (no shader change). - Coverage gaps: everything in the game; the reappearance of the white grain on floors with the estimate on (the claim that the estimate removes its cause is the fork author's, not ours); the cost; the estimate itself is off by default and has its own known colour problems, which this does not touch. ## Checklist - [x] This PR contains one change based on `main`. (`git diff --stat 4db98e011 e8f3642db`: the 4 files above. The branch is on `4db98e011`, not on current `main`; a trial merge is clean, see Base.) - [x] The diff follows `docs/asset-policy.md`. (Text only; `cargo xtask policy` passed.) - [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 3 issues (#1, #2, #4) and 8 pull requests (#3 by another contributor; #5 to #11 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. Our sibling branches `pr6-raymiss-clear` (`DARNER_RAYMISS_CLEAR`) and `pr6-specular-fill` (`DARNER_AMBIENT_SPECULAR_FILL`) also edit `sky_miss_left_out`, and with `pr6-air-room` all add a row and bump the setting count in the README's "Lighting and ray tracing" table. The fill branch and this one conflict textually in one closure of `sky_miss_left_out` if both merge. Earlier reports on CodeFloe (not migrated) about lighting jumps with ray tracing off, reflections picking up texture colours and reflection ghosting are related, not claimed fixed. - 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`). #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).
The opaque layer's miss program is left out for the sky light it gives each
ray (white grain on floors). With the reflection stand-in on
(DARNER_AMBIENT_SPECULAR) that light is replaced by the estimate, while
leaving the program out keeps earlier frames' bytes: colour noise on a convex
mirror, glowing patches on a cell floor (BaRian29's capture). With the switch
and the stand-in on, it runs. miss_left_out is a pure function with a test.

Port of BaRian29's fork commit 5c212d21b (old PR #3580; on whenever the
stand-in was there). The stand-in check is ambient::specular_on (new) and
ambient::on, since DARNER_AMBIENT alone makes the latter true. No shader change.

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

This change was made with AI assistance (Claude Code).
The row and the findings entry for the commit before (port of BaRian29's fork commit 5c212d21b).

This change was made with AI assistance (Claude Code).
Jesper-A changed title from WIP: [pr-fix][rendering][lighting] Reflections: the opaque miss program runs under the reflection estimate (DARNER_RAYMISS_ESTIMATED=1, off by default) to [pr-fix][rendering][lighting] Reflections: the opaque miss program runs under the reflection estimate (DARNER_RAYMISS_ESTIMATED=1, off by default) 2026-12-03 18:29:33 +00:00
This pull request has changes conflicting with the target branch.
  • 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-raymiss-estimated:Jesper-A-pr6-raymiss-estimated'
git switch 'Jesper-A-pr6-raymiss-estimated'

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-raymiss-estimated'
git switch 'Jesper-A-pr6-raymiss-estimated'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-raymiss-estimated'
git switch 'Jesper-A-pr6-raymiss-estimated'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Jesper-A-pr6-raymiss-estimated'
git switch 'main'
git merge --squash 'Jesper-A-pr6-raymiss-estimated'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-raymiss-estimated'
git switch 'main'
git merge 'Jesper-A-pr6-raymiss-estimated'
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!14
No description provided.