From 7bd579d370d8cf7aec77762019f6972d7cefcf27 Mon Sep 17 00:00:00 2001 From: codexx-dev Date: Mon, 23 Nov 2026 23:23:36 -0300 Subject: [PATCH] With FSR the upscaler waits for the first composite without depth after the lighting, so the fog layer and the clouds go through it and distant ridges no longer get a flickering bright outline at night and at dawn The upscaler ran at the first pass into the light target after the lighting. The fog layer and the half-size clouds' composite that follow it decide per pixel from the scene depth, still jittered, whether a pixel is sky; over the upscaler's steady picture a sky pixel on a silhouette took the surface's side in some frames and got no clouds there, a bright dot that the upscaler never resolved. effects_point now waits for the first full-size pass without depth into the light target and runs before the next pass with a depth (the particles), behind TOTK_DLAA_FX_COMPOSITE: on by default with FSR, off with DLSS until measured on NVIDIA hardware. Frame dumps at 2560x1440 with FSR 4: ridge pixels brighter than both sides fall from 34 % of the columns to 15 %. Co-Authored-By: Claude Opus 5.5 --- docs/agents/symptoms.md | 1 + docs/settings.md | 1 + runtime/cfg.c | 2 +- runtime/vk_dlaa.c | 23 +++++++++++++++++++++-- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/docs/agents/symptoms.md b/docs/agents/symptoms.md index 378eb709..694bc165 100644 --- a/docs/agents/symptoms.md +++ b/docs/agents/symptoms.md @@ -33,6 +33,7 @@ GPU semantics behind the graphics rows: [maxwell.md](../maxwell.md). The method | with DLAA/DLSS on, large distant blocks behind the fog (the Depths) turn darker or lighter for a frame while the camera moves | DLSS created with AutoExposure estimated the exposure of the dark scene itself, and the estimate moved from frame to frame (fixed with `dlss_fixed_exposure = 1`: `vk_dlaa.c` evaluate creates the feature without it) | a flat fogged patch in `capture.py` frames: one value without DLAA, jumps with it | | flicker or a texture swapped with a similar one | the newest texture picked at shared storage instead of the one with the matching view | texture lookup by id in the dump | | with DLAA on, dust and small particles in fog (shrines) vanish, smear or behave oddly; the fog looks processed | DLSS ran at the bloom, after the fog and the particles, which have no motion vectors or jitter of their own (fixed: `vk_dlaa.c` effects_point runs DLSS at the first pass into the light target after the lighting, and the effects go over its picture) | `dlaa_effects_after = 0` (Screen tab) brings the old point back; the count "before the effects" in the `dlaa:` log line against the frames anti-aliased | +| with FSR on, a white or bright dotted outline along distant mountains and other silhouettes against the sky, most visible at night and at dawn against clouds; weaker without FSR, `TOTK_DEMOTE` makes no difference | the upscaler ran at the first pass after the lighting, and the fog layer and the half-size clouds' composite that follow it decide per pixel from the scene depth, still jittered, whether it is sky: over the upscaler's steady picture a sky pixel on a ridge took the mountain's side in some frames and got no clouds (fixed for FSR: `vk_dlaa.c` `effects_point` waits for the first composite without depth, `dlaa_fx_composite`) | `TOTK_DLAA_FX_COMPOSITE=0` brings it back; `TOTK_DLAA_JITTER=0` or `dlaa_effects_after = 0` make it go; frame dump: ridge pixels brighter than the sky and the mountain in the composite pass into the light target | | with DLAA on, the picture flickers from frame to frame: a little outdoors; the whole scene in a fogged shrine with an ability's targeting view (Ultrahand) open, where the fog also goes back under DLSS | DLSS ran before some effects in one frame and after them in the next: their order changes from frame to frame (the yard's half-size effects pass is in some frames only; the ability highlight, drawn into the light target with a D16 depth of its own, comes before or after the fog layer), and a rule that waited for one of them or took any D16 pass for the lighting followed it (fixed: `vk_dlaa.c` effects_point knows the lighting by its depth and runs DLSS right after it) | the `dlaa:` log line: "before the effects" must equal the frames anti-aliased in the world; a log of the passes into the light target per frame | ## Timing and frame pacing diff --git a/docs/settings.md b/docs/settings.md index 83b774b5..081331fd 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -189,6 +189,7 @@ Many rows below are developer tools that only act together with another setting | Setting | What it does | Effect of changing it | Safety | | --- | --- | --- | --- | | `dlaa_cam_jitter` (default `1`) | Game 1.4.3: `1` puts the jitter fed to DLSS into the game's camera (the projection's centre terms and the view-projection, where the game copies them into its camera blocks); `0` moves the viewport of the scene's draws instead, as on the other game versions. Needs `ubo_snapshot`. | With `0`, water seen at a low angle flickers with DLAA: the game's full-screen passes rebuild positions with a camera the scene was not drawn with; a test setting. | Caution | +| `dlaa_fx_composite` (default `1` with FSR, `0` with DLSS) | Where the upscaler runs among the effects drawn after the lighting: `1` waits for the first full-size composite without depth into the light target (the clouds outdoors, the volumetric fog in shrines) and runs before the next pass with a depth (the particles), so the fog layer and the clouds go through the upscaler; `0` runs it at the first pass after the lighting (`runtime/vk_dlaa.c` `effects_point`). Only with `dlaa_effects_after = 1`. | With `0` and FSR, distant ridges against clouds or fog get a flickering bright outline at night and at dawn: the fog and the clouds are tested against the jittered depth over the upscaler's steady picture. With `1` on DLSS: not measured on NVIDIA hardware. | Caution | | `dlaa_jitter` (default `1`) | `0` turns off the camera jitter fed to DLSS. | DLSS gets no jitter between frames; a test setting. | Caution | | `dlaa_maskdebug` (default `0`) | `1` shows the reactive mask in place of the picture. | The frame shows a debug image while it is set. | Caution | | `dlaa_mv` (default `1`) | `0` sends zero motion vectors to DLSS. | DLSS sees no motion, so moving content can smear; a test setting. | Caution | diff --git a/runtime/cfg.c b/runtime/cfg.c index e6722ae8..7732dc14 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -41,7 +41,7 @@ static const char *const known[] = { "BIND_INC", "BIND_SKIP", "BIND_STATS", "BIND_UP", "BIND_X", "BIND_Y", "BIND_ZL", "BIND_ZR", "BARRIER_MERGE", "BLOCK_VIEWS_3D", "CLIMB_FIX", "CLOTH_REALTIME", "COLOR_BRIGHTNESS", "COLOR_CONTRAST", "COLOR_GAMMA", "COLOR_PRESET", "COLOR_SATURATION", "CONTACT_DEBUG", "CONTACT_SHADOWS", "CORE_DIAG", "CRIT", "CRIT_OUT", - "DESC_TEMPLATE", "DESWIZZLE", "DEVICE_PROFILE", "DIALOGUE_CLICK", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_CAM_JITTER", "DLAA_EFFECTS_AFTER", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_FIXED_EXPOSURE", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR", + "DESC_TEMPLATE", "DESWIZZLE", "DEVICE_PROFILE", "DIALOGUE_CLICK", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_CAM_JITTER", "DLAA_EFFECTS_AFTER", "DLAA_FX_COMPOSITE", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_FIXED_EXPOSURE", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR", "DUMP_LOG", "DYNAMIC_RES", "DYN_DELTA", "EXEFS", "FEEDBACK", "FG_DEBUG", "FG_OBJECTS", "FG_SHOT", "FG_SHOT_DIR", "FG_TEST", "FG_TIMES", "FIXED_RES_PATCH", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES", "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FRAME_GEN", "FRAME_QUEUE", "FREECAM_KEY", "FREECAM_PAD", "FREECAM_PATCH", "FREEZE_IDLE", "FREE_CORES", "FSR3_DEBUG", "FSR3_VIEW", "FSR4_DEBUG", "FSR_SHARPNESS", diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index 96569ef3..30832bc9 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -327,6 +327,7 @@ static struct { VkImage light_z; // this frame: the D16 depth the lighting draws into the light target with int fx_on; // dlaa_effects_after, read at each present while DLSS runs int fx_seen, fx_open, fx_bad; // this frame: the point found / the scene not ended since / drawn on after it + int fx_comp; // this frame: a full-size pass into the light target without depth after the lighting uint32_t fx_steady; // DLSS frames in a row with the point found and nothing of the scene after it // jitter (vk_dlaa_viewport) VkImage jdepth; // the scene depth of the last frame DLAA ran on: passes drawing with it are jittered @@ -1617,9 +1618,25 @@ static void gbuf_light(const VkExec *ex) { // breaks it puts DLSS back at the bloom until it holds again, so a frame the rule does not fit changes the picture at // most once a second instead of from frame to frame. // dlaa_effects_after = 0 (the Screen tab, read each frame): DLSS at the bloom, effects included. +// With FSR the point waits for the first full-size pass into the light target without depth (the composite of the +// half-size clouds outdoors, of the volumetric fog in shrines, of the field's effects in the yard) and runs before the +// next pass with a depth, the particles or the dust. The fog layer and those composites are drawn over the whole +// picture and decide per pixel from the scene depth whether a pixel is sky or a surface; over the upscaler's picture +// that depth is still this frame's jittered one while the picture is not, so on a silhouette against clouds or fog a +// pixel the picture shows as sky took the surface's side of the test in some frames: no clouds or fog there that +// frame, a brighter dot along distant ridges at night and at dawn, flickering with the jitter's phase and never +// resolved, since it came after the upscaler. Measured at 2560x1440 with FSR 4 (frame dumps, a ridge against the +// night sky): a ridge pixel brighter than the sky and the mountain beside it in 34 % of the columns with the point +// before the fog layer, 6-7 % (as with the upscaler off) with it after the composite. These layers are smooth and +// follow the scene, so the upscaler takes them with the scene's motion; the particles still go over its picture. +// A frame without such a composite before the bloom runs the upscaler at the bloom, and the FX_STEADY count holds the +// point back as for any frame the rule does not fit. TOTK_DLAA_FX_COMPOSITE=0 (test) puts the point back at the first +// pass after the lighting; =1 also moves it with DLSS, where it is off by default until measured on NVIDIA hardware. #define FX_STEADY 60u static int effects_point(const VkExec *ex) { + static int after_comp = -1; + if (after_comp < 0) after_comp = rt_knob("DLAA_FX_COMPOSITE", D.fsr ? "1" : "0"); const VkExecTarget *c = &ex->color[0], *z = &ex->depth; if (!D.fx_on || D.fx_bad || !D.glight || D.ended || ex->pass_ncolor != 1 || c->image != D.glight || c->level) return 0; if (!D.light_z) { @@ -1630,6 +1647,8 @@ static int effects_point(const VkExec *ex) { unsigned o[2], s[2]; res_sizes(o, s); if (c->width < o[0] || !scene_shaped(c) || !scene_large(c)) return 0; + if (after_comp && !z->image) D.fx_comp = 1; // asked again at the same pass: the same answer + if (after_comp && (!D.fx_comp || !z->image)) return 0; D.fx_seen = D.fx_open = 1; return D.fx_steady >= FX_STEADY; } @@ -1948,7 +1967,7 @@ void vk_dlaa_frame(void) { D.on = on, D.fg = vk_dlaa_fg_on = fg, D.fsr = fsr; // either way the next DLAA frame starts a new history from an unjittered frame D.reset = 1, D.cam_prev_ok = 0, D.jit_ok = D.jit_used = D.armed = D.done = D.gbuf = D.ended = D.up = 0; - D.fx_seen = D.fx_open = D.fx_bad = 0, D.fx_steady = 0; + D.fx_seen = D.fx_open = D.fx_bad = D.fx_comp = 0, D.fx_steady = 0; D.nodepth = D.glight = D.light_z = VK_NULL_HANDLE; D.hold = 0; return; @@ -1957,7 +1976,7 @@ void vk_dlaa_frame(void) { D.fx_on = dl_active() && cfg_bool("TOTK_DLAA_EFFECTS_AFTER"); // DLSS's point alone if (!D.done) D.frames_missed++; else D.fx_steady = D.fx_seen ? D.fx_steady + (D.fx_steady < FX_STEADY) : 0; - D.fx_seen = D.fx_open = D.fx_bad = 0; + D.fx_seen = D.fx_open = D.fx_bad = D.fx_comp = 0; if (D.jit_used && !D.done) D.hold = 60, D.holds++; // jittered but not resolved: that frame shook else if (D.hold) D.hold--; if (!D.done) D.jit_ok = 0;