DLSS Ray Reconstruction replacing the in game de-noiser for better quality shadows and reflections #431

Open
paales wants to merge 8 commits from paales/ray-reconstruction into Main AGit
First-time contributor

Written by 🤖:

Refs #66, Refs #109. Replaces #401 (the same denoiser switch, now with Ray Reconstruction and one F1 row; #401 can be closed).

Contributor role (optional)

  • Fluxer ID:

What it changes

  • The problem on main: DLSS upscales the game's picture after the game's own denoisers have filtered its ray-traced light. Those filters leave blocks, blotches and sparkles in reflections and blur contact shadows, the glass resolve CS_TemporalResolve1_Alpha is dropped on 32-lane hosts (#66) so some glass is dark (the cafe window in the police cutscene), and there is no DLSS Ray Reconstruction (#109).

One F1 row, PICTURE > RAY RECONSTRUCTION (DARNER_RR=1, off by default):

  • DLSS Ray Reconstruction in place of DLSS Super Resolution. Its guides are made from the game's G-buffer by a pass of ours (linear albedo, specular albedo from the game's F0, world-space normals with roughness from its octahedral normals and gloss, the game's own camera); a frame without every guide is upscaled by SR, with the reason in the log. The port is NICKNAMErutschovkonikovan's code from VIctory PRs #3590 and #3854 (GPL-3.0-or-later), fitted to Darner's DLSS recording; DARNER_RR_HIT=1 (off) adds the reflections' hit distance.
  • With it on, darner run leaves out the game's own spatial filters for its reflections and shadows, through paths the game has itself (8 code patches in KnownBuild::denoiser_filters and denoiser_histories, each checked against its old bytes as the existing patches are):
Group Effect Path the game takes
filters (off with RR) Reflections The settings loader writes 0 to the spatial-filter bool: TemporalResolveOpaque in place of SpatialFilter_Std, SpatialFilter and TemporalResolve2. Blur count 0: no BilateralBlur, no UpdateHistory.
filters (off with RR) Shadows The shadow mask's denoise stage (passes 12 to 21, in place) is not called: the lighting reads the traced mask.
histories (kept with RR) Reflections, GI History length 1 and the frame setup's camera-cut path every frame.

The histories stay with RR: without them the GI's screen probes and the reflections change every frame in patches, and the picture boils in motion, with SR and with RR. DARNER_TITLE_DENOISERS=0 leaves out both groups (for tests), 1 neither. The GI probe filters and the bent cones have no such path and stay.

How it was tested

  • Tested revision: 78655ede plus the docs commit on top (no code change after the build that was played).

  • Commands and results: see the gates line. cargo test -p darner-gpu --lib menu -- --include-ignored makes the picture of the new row (DARNER_MENU_SHOT).

  • Changes a default: no. RAY RECONSTRUCTION is off by default, and nothing changes for a player who does not turn it on.

  • How the off-by-default row was checked, in the game, RTX 5070 Ti, Series X profile, 3840x2160 output, DLSS Performance, hardware ray tracing:

    • Played on this revision, house save and night parking lot, three ways from the same save: RR (the row), the game's own denoisers (SR), and no denoising at all (DARNER_TITLE_DENOISERS=0, SR). With the row on the log has "DLSS Ray Reconstruction is ready" and hardware ray tracing on.
    • Measured on an older base with the same patches through DARNER_TITLE_PATCH (one run each way, static view 16 to 30 s, change between captures 500 ms apart, 0 to 255, both groups out):
    A (denoisers on) B (both groups out)
    SR: bush shadow on a pillar, change between captures 1.81 4.01
    RR: the same shadow 1.61 2.29
    • The dispatch capture with both groups out has no SpatialFilter_Std, SpatialFilter, TemporalResolve2, TemporalResolve1_Alpha, BilateralBlur, UpdateHistory or DenoiseShadowMaskLDSPacked; none of them is among the 60 most costly pipelines (DARNER_CARD_METER_PIPELINES=1, 0.06 ms a frame each at most). RR takes 1 to 2 ms a frame more card time than SR; the frame rate does not change.
  • Gates run on this revision: both clippy gates pass. cargo test --workspace --locked was not run to the end on this revision; on the denoiser commit alone it had 2117 passed and 1 failed, a write-watch test that fails now and then on main too.

  • Shader wave sizes tested: 32 lanes.

  • Hardware dependence: RR needs an NVIDIA card with DLSS; the patches are in the game's own code. The dark glass needs a 32-lane host (#66).

  • Coverage gaps: AMD, Intel and Series S not tested. The final RR setting (filters out, histories kept) was checked by play, not by a measured run. The cafe glass result was measured with both groups out.

Pictures (cropped from 3840x2160 captures) follow in a comment.

Checklist

  • I ran this change in the game, or say below why it can't be (docs, tests only).
  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • 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: #80 (DLSS 5 neural rendering, the same Streamline code), #9, #12 and #16 (rows on the same F1 page), #328 (F1 menu clicks), #14, #15 and #17 (reflection fixes in other code).
  • Replaces or overlaps: #401 (the denoiser switch alone, without RR; this one replaces it).
_Written by 🤖:_ Refs #66, Refs #109. Replaces #401 (the same denoiser switch, now with Ray Reconstruction and one F1 row; #401 can be closed). ## Contributor role (optional) - Fluxer ID: ## What it changes - The problem on main: DLSS upscales the game's picture after the game's own denoisers have filtered its ray-traced light. Those filters leave blocks, blotches and sparkles in reflections and blur contact shadows, the glass resolve `CS_TemporalResolve1_Alpha` is dropped on 32-lane hosts (#66) so some glass is dark (the cafe window in the police cutscene), and there is no DLSS Ray Reconstruction (#109). One F1 row, PICTURE > RAY RECONSTRUCTION (`DARNER_RR=1`, off by default): - DLSS Ray Reconstruction in place of DLSS Super Resolution. Its guides are made from the game's G-buffer by a pass of ours (linear albedo, specular albedo from the game's F0, world-space normals with roughness from its octahedral normals and gloss, the game's own camera); a frame without every guide is upscaled by SR, with the reason in the log. The port is NICKNAMErutschovkonikovan's code from VIctory PRs #3590 and #3854 (GPL-3.0-or-later), fitted to Darner's DLSS recording; `DARNER_RR_HIT=1` (off) adds the reflections' hit distance. - With it on, `darner run` leaves out the game's own spatial filters for its reflections and shadows, through paths the game has itself (8 code patches in `KnownBuild::denoiser_filters` and `denoiser_histories`, each checked against its old bytes as the existing patches are): | Group | Effect | Path the game takes | |---|---|---| | filters (off with RR) | Reflections | The settings loader writes 0 to the spatial-filter bool: `TemporalResolveOpaque` in place of `SpatialFilter_Std`, `SpatialFilter` and `TemporalResolve2`. Blur count 0: no `BilateralBlur`, no `UpdateHistory`. | | filters (off with RR) | Shadows | The shadow mask's denoise stage (passes 12 to 21, in place) is not called: the lighting reads the traced mask. | | histories (kept with RR) | Reflections, GI | History length 1 and the frame setup's camera-cut path every frame. | The histories stay with RR: without them the GI's screen probes and the reflections change every frame in patches, and the picture boils in motion, with SR and with RR. `DARNER_TITLE_DENOISERS=0` leaves out both groups (for tests), `1` neither. The GI probe filters and the bent cones have no such path and stay. ## How it was tested - Tested revision: 78655ede plus the docs commit on top (no code change after the build that was played). - Commands and results: see the gates line. `cargo test -p darner-gpu --lib menu -- --include-ignored` makes the picture of the new row (`DARNER_MENU_SHOT`). - Changes a default: no. RAY RECONSTRUCTION is off by default, and nothing changes for a player who does not turn it on. - How the off-by-default row was checked, in the game, RTX 5070 Ti, Series X profile, 3840x2160 output, DLSS Performance, hardware ray tracing: - Played on this revision, house save and night parking lot, three ways from the same save: RR (the row), the game's own denoisers (SR), and no denoising at all (`DARNER_TITLE_DENOISERS=0`, SR). With the row on the log has "DLSS Ray Reconstruction is ready" and hardware ray tracing on. - Measured on an older base with the same patches through `DARNER_TITLE_PATCH` (one run each way, static view 16 to 30 s, change between captures 500 ms apart, 0 to 255, both groups out): | | A (denoisers on) | B (both groups out) | |---|---|---| | SR: bush shadow on a pillar, change between captures | 1.81 | 4.01 | | RR: the same shadow | 1.61 | 2.29 | - The dispatch capture with both groups out has no `SpatialFilter_Std`, `SpatialFilter`, `TemporalResolve2`, `TemporalResolve1_Alpha`, `BilateralBlur`, `UpdateHistory` or `DenoiseShadowMaskLDSPacked`; none of them is among the 60 most costly pipelines (`DARNER_CARD_METER_PIPELINES=1`, 0.06 ms a frame each at most). RR takes 1 to 2 ms a frame more card time than SR; the frame rate does not change. - Gates run on this revision: both clippy gates pass. `cargo test --workspace --locked` was not run to the end on this revision; on the denoiser commit alone it had 2117 passed and 1 failed, a write-watch test that fails now and then on `main` too. - Shader wave sizes tested: 32 lanes. - Hardware dependence: RR needs an NVIDIA card with DLSS; the patches are in the game's own code. The dark glass needs a 32-lane host (#66). - Coverage gaps: AMD, Intel and Series S not tested. The final RR setting (filters out, histories kept) was checked by play, not by a measured run. The cafe glass result was measured with both groups out. Pictures (cropped from 3840x2160 captures) follow in a comment. ## Checklist - [x] I ran this change in the game, or say below why it can't be (docs, tests only). - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [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: #80 (DLSS 5 neural rendering, the same Streamline code), #9, #12 and #16 (rows on the same F1 page), #328 (F1 menu clicks), #14, #15 and #17 (reflection fixes in other code). - Replaces or overlaps: #401 (the denoiser switch alone, without RR; this one replaces it).
Author
First-time contributor
paales changed title from [pr-feature][rendering][lighting][dlss][RAYTRACING][NVIDIA] F1 RAY RECONSTRUCTION: DLSS Ray Reconstruction, with the game's own ray tracing filters off (DARNER_RR=1, off by default) to [pr-feature] DLSS Ray Reconstruction replacing the in game de-noiser for better quality shadows and reflections 2026-12-04 23:57:39 +00:00
Author
First-time contributor

https://drive.google.com/drive/folders/11MO1mXMCcQA_5gkE_PJkbFkOot0Po-gB?usp=sharing See 431 videos. Download for better quality. (and non broken HDR tone mapping :p)
Also check out PR !456

https://drive.google.com/drive/folders/11MO1mXMCcQA_5gkE_PJkbFkOot0Po-gB?usp=sharing See 431 videos. Download for better quality. (and non broken HDR tone mapping :p) Also check out PR !456
Contributor

Written by 🤖, results are mine.

Tested on my integration branch, which carries this PR with DARNER_RR=1 on by default: theforgotten669/Darner integration/rtx4090 @ eba6512. 9800X3D, RTX 4090, driver 621.47, 4K, Series X, DLSS Quality, FG 2x, hardware RT.

Works: with sl.dlss_d.dll present (DLSS Ray Reconstruction is ready, NGX 310.9.16), the blotches and boiling the main post describes are gone; RT shadows and reflections look clean.

Bug: without sl.dlss_d.dll, RR stays off (no sl.dlss_d.dll in NVIDIA's folder) but the "filters (off with RR)" group is still patched out, so the shadow mask's denoise stage is skipped with nothing in its place and shadows boil badly. run.rs decides on DARNER_RR=1 && DARNER_DLSS=1 at load, before Streamline reports whether RR can start. Suggest patching the filters only once RR is known to be available (e.g. check sl.dlss_d.dll/nvngx_dlssd.dll beside the interposer), or keeping the row off without them.

_Written by 🤖, results are mine._ Tested on my integration branch, which carries this PR with `DARNER_RR=1` on by default: [theforgotten669/Darner `integration/rtx4090` @ `eba6512`](https://git.gtahub.st/theforgotten669/Darner/src/branch/integration/rtx4090). 9800X3D, RTX 4090, driver 621.47, 4K, Series X, DLSS Quality, FG 2x, hardware RT. **Works:** with `sl.dlss_d.dll` present (`DLSS Ray Reconstruction is ready`, NGX 310.9.16), the blotches and boiling the main post describes are gone; RT shadows and reflections look clean. **Bug:** without `sl.dlss_d.dll`, RR stays off (`no sl.dlss_d.dll in NVIDIA's folder`) but the "filters (off with RR)" group is still patched out, so the shadow mask's denoise stage is skipped with nothing in its place and shadows boil badly. `run.rs` decides on `DARNER_RR=1 && DARNER_DLSS=1` at load, before Streamline reports whether RR can start. Suggest patching the filters only once RR is known to be available (e.g. check `sl.dlss_d.dll`/`nvngx_dlssd.dll` beside the interposer), or keeping the row off without them.
Contributor

Tested on Linux under Proton (proton-cachyos), RTX 4080, driver 620.73, Series S profile, DLAA, FG 2x, hardware RT. This PR is merged on top of main d91d8e4 plus a few other PRs in our integration branch.

Works here too. With sl.dlss_d.dll and nvngx_dlssd.dll from the Streamline 2.14.1 SDK beside the 2.14.1 interposer, the log says DLSS Ray Reconstruction is ready (NGX 310.9.1) and then first upscaling recorded in place of DLSS SR (1280x720 to 3840x2160). Window glass reflects the deck and the railing cleanly, without the filter's blocks. Frames took about 41 ms (24 fps, 49 with FG), as they do without RR in that scene.

A fix for the bug theforgotten669 found (the filters are patched out even when RR cannot start). We needed it, so here is what we did. Please take it as you like:

  • crates/darner-gpu/src/streamline.rs: two small public functions. The game and the check resolve the folder the same way. Asked uses the first one for dir in place of its own var(...).
/// The folder the game loads Streamline from: `DARNER_STREAMLINE_DIR`, else [`DEFAULT_DIR`].
pub fn dir_from_env() -> PathBuf {
    std::env::var("DARNER_STREAMLINE_DIR").map_or_else(|_| PathBuf::from(DEFAULT_DIR), PathBuf::from)
}

/// Whether both files Ray Reconstruction loads (`rr::FILES`) are in `dir`. Without them it never
/// starts and DLSS upscales with Super Resolution.
pub fn rr_files_in(dir: &Path) -> bool {
    rr::FILES.iter().all(|file| dir.join(file).is_file())
}
  • apps/darner/src/run.rs: the choice in apply_title_patches moves into a function. When RR is asked for but its files are missing, the filters stay, with a line in the log. DARNER_TITLE_DENOISERS=0 and =1 work as before. darner reaches them through the existing darner_hle::streamline re-export, because it does not depend on darner-gpu directly.
fn denoiser_lists(
    build: Option<&darner_game::KnownBuild>,
    switch: &str,
    rr_asked: bool,
    streamline_dir: &Path,
) -> (&'static str, Option<[&'static [darner_game::CodePatch]; 2]>) {
    match switch.trim() {
        "0" => ("DARNER_TITLE_DENOISERS=0", build.map(|b| [b.denoiser_filters, b.denoiser_histories])),
        "" if rr_asked && !darner_hle::streamline::rr_files_in(streamline_dir) => {
            println!(
                "title patch    DARNER_RR=1: Ray Reconstruction's two files are not in {}, so the denoisers stay",
                streamline_dir.display()
            );
            ("", None)
        }
        "" if rr_asked => ("DARNER_RR=1", build.map(|b| [b.denoiser_filters, &[][..]])),
        _ => ("", None),
    }
}

apply_title_patches then does let (why, lists) = denoiser_lists(build, &switch, rr_asked, &darner_hle::streamline::dir_from_env()); and goes on as before.

There is a test, run::denoiser_tests::ray_reconstruction_takes_the_filters_only_with_its_files, that uses a temporary folder. It checks five cases:

  • with neither file, nothing is patched;
  • with one file, nothing is patched, and DARNER_TITLE_DENOISERS=0 still patches both lists;
  • with both files, only the filters are patched;
  • DARNER_TITLE_DENOISERS=1 patches nothing;
  • when RR is not asked for, nothing is patched.

It passes under Proton, and so do the streamline, shader_cache and menu tests of darner-gpu, with three exceptions: three menu tests fail the same way on main in this Wine (font sizes and a process path), so the merge did not cause them. I can open this as a PR against your branch if that is easier.

Tested on Linux under Proton (proton-cachyos), RTX 4080, driver 620.73, Series S profile, DLAA, FG 2x, hardware RT. This PR is merged on top of main `d91d8e4` plus a few other PRs in our integration branch. **Works here too.** With `sl.dlss_d.dll` and `nvngx_dlssd.dll` from the Streamline 2.14.1 SDK beside the 2.14.1 interposer, the log says `DLSS Ray Reconstruction is ready` (NGX 310.9.1) and then `first upscaling recorded in place of DLSS SR` (1280x720 to 3840x2160). Window glass reflects the deck and the railing cleanly, without the filter's blocks. Frames took about 41 ms (24 fps, 49 with FG), as they do without RR in that scene. **A fix for the bug theforgotten669 found** (the filters are patched out even when RR cannot start). We needed it, so here is what we did. Please take it as you like: - `crates/darner-gpu/src/streamline.rs`: two small public functions. The game and the check resolve the folder the same way. `Asked` uses the first one for `dir` in place of its own `var(...)`. ```rust /// The folder the game loads Streamline from: `DARNER_STREAMLINE_DIR`, else [`DEFAULT_DIR`]. pub fn dir_from_env() -> PathBuf { std::env::var("DARNER_STREAMLINE_DIR").map_or_else(|_| PathBuf::from(DEFAULT_DIR), PathBuf::from) } /// Whether both files Ray Reconstruction loads (`rr::FILES`) are in `dir`. Without them it never /// starts and DLSS upscales with Super Resolution. pub fn rr_files_in(dir: &Path) -> bool { rr::FILES.iter().all(|file| dir.join(file).is_file()) } ``` - `apps/darner/src/run.rs`: the choice in `apply_title_patches` moves into a function. When RR is asked for but its files are missing, the filters stay, with a line in the log. `DARNER_TITLE_DENOISERS=0` and `=1` work as before. `darner` reaches them through the existing `darner_hle::streamline` re-export, because it does not depend on `darner-gpu` directly. ```rust fn denoiser_lists( build: Option<&darner_game::KnownBuild>, switch: &str, rr_asked: bool, streamline_dir: &Path, ) -> (&'static str, Option<[&'static [darner_game::CodePatch]; 2]>) { match switch.trim() { "0" => ("DARNER_TITLE_DENOISERS=0", build.map(|b| [b.denoiser_filters, b.denoiser_histories])), "" if rr_asked && !darner_hle::streamline::rr_files_in(streamline_dir) => { println!( "title patch DARNER_RR=1: Ray Reconstruction's two files are not in {}, so the denoisers stay", streamline_dir.display() ); ("", None) } "" if rr_asked => ("DARNER_RR=1", build.map(|b| [b.denoiser_filters, &[][..]])), _ => ("", None), } } ``` `apply_title_patches` then does `let (why, lists) = denoiser_lists(build, &switch, rr_asked, &darner_hle::streamline::dir_from_env());` and goes on as before. There is a test, `run::denoiser_tests::ray_reconstruction_takes_the_filters_only_with_its_files`, that uses a temporary folder. It checks five cases: - with neither file, nothing is patched; - with one file, nothing is patched, and `DARNER_TITLE_DENOISERS=0` still patches both lists; - with both files, only the filters are patched; - `DARNER_TITLE_DENOISERS=1` patches nothing; - when RR is not asked for, nothing is patched. It passes under Proton, and so do the `streamline`, `shader_cache` and `menu` tests of `darner-gpu`, with three exceptions: three `menu` tests fail the same way on main in this Wine (font sizes and a process path), so the merge did not cause them. I can open this as a PR against your branch if that is easier.
TrustNo1 changed title from [pr-feature] DLSS Ray Reconstruction replacing the in game de-noiser for better quality shadows and reflections to DLSS Ray Reconstruction replacing the in game de-noiser for better quality shadows and reflections 2026-12-06 03:29:04 +00:00
Owner

Test needed — commit bc729511; what to check:

  • The problem on main: DLSS upscales the game's picture after the game's own denoisers have filtered its ray-traced light. Those filters leave blocks, blotches and sparkles in reflections and blur contact shadows, the glass resolve CS_TemporalResolve1_Alpha is dropped on 32-lane hosts (#66) so some glass is dark (the cafe window in the police cutscene), and there is no DLSS Ray Reconstruction (#109).

One F1 row, PICTURE > RAY RECONSTRUCTION (DARNER_RR=1, off by default):

  • DLSS Ray Reconstruction in place of DLSS Super Resolution. Its guides are made from the game's G-buffer by a pass of ours (linear albedo, specular albedo from the game's F0, world-space normals with roughness from its octahedral normals and gloss, the game's own camera); a frame without every guide is upscaled by SR, with the reason in the log. The port is NICKNAMErutschovkonikovan's code from an earlier fork PRs #3590 and #3854 (GPL-3.0-or-later), fitted to Darner's DLSS recording; DARNER_RR_HIT=1 (off) adds the reflections' hit distance.
  • With it on, darner run leaves out the game's own spatial filters for its reflections and shadows, through paths the game has itself (8 code patches in `KnownBuild::denoiser

Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture.

Reply testing to take this run; it's free again after 24 h with no results.

**Test needed** — commit `bc729511`; what to check: - The problem on main: DLSS upscales the game's picture after the game's own denoisers have filtered its ray-traced light. Those filters leave blocks, blotches and sparkles in reflections and blur contact shadows, the glass resolve `CS_TemporalResolve1_Alpha` is dropped on 32-lane hosts (#66) so some glass is dark (the cafe window in the police cutscene), and there is no DLSS Ray Reconstruction (#109). One F1 row, PICTURE > RAY RECONSTRUCTION (`DARNER_RR=1`, off by default): - DLSS Ray Reconstruction in place of DLSS Super Resolution. Its guides are made from the game's G-buffer by a pass of ours (linear albedo, specular albedo from the game's F0, world-space normals with roughness from its octahedral normals and gloss, the game's own camera); a frame without every guide is upscaled by SR, with the reason in the log. The port is NICKNAMErutschovkonikovan's code from an earlier fork PRs #3590 and #3854 (GPL-3.0-or-later), fitted to Darner's DLSS recording; `DARNER_RR_HIT=1` (off) adds the reflections' hit distance. - With it on, `darner run` leaves out the game's own spatial filters for its reflections and shadows, through paths the game has itself (8 code patches in `KnownBuild::denoiser Evidence to post: card + driver, settings, commit tested, before/after (switch off vs on, two runs each), fps median and p99, and one line saying you looked at the picture. Reply `testing` to take this run; it's free again after 24 h with no results.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/431/head:paales/ray-reconstruction'
git switch 'paales/ray-reconstruction'

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 'paales/ray-reconstruction'
git switch 'paales/ray-reconstruction'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'paales/ray-reconstruction'
git switch 'paales/ray-reconstruction'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'paales/ray-reconstruction'
git switch 'Main'
git merge --squash 'paales/ray-reconstruction'
git switch 'Main'
git merge --ff-only 'paales/ray-reconstruction'
git switch 'Main'
git merge 'paales/ray-reconstruction'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
4 participants
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!431
No description provided.