fix(vk): DLSS and DLAA sample textures at NVIDIA's mip bias #2441
No reviewers
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot!2441
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/dlss-sharpness"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why DLSS looked soft
DLSS builds a picture finer than its input pixels by combining several frames, each rendered with a slightly different sub-pixel camera offset. For that to work, the input has to carry the fine texture detail. NVIDIA's DLSS guide (section 3.5, Mip-Map Bias) says to sample textures at the output size's mip level and one step finer:
native bias + log2(render / output) - 1.0.Hookshot added only
log2(share / 0.75)on top of the game's own -0.5 bias (the game's bias for its own upscaler at 3/4). That gave:So DLSS was given the softer mips of the smaller 3D and upscaled those.
What changes
log2(share / 0.75) - 1on top of the game's bias. That is Quality -1.17, Balanced -1.37, Performance -1.58, Ultra Performance -2.17, DLAA -0.58. Auto is taken as the game's 3/4, which gives -1.RX_VK_DLSS_LOD_OFFSET=<steps>sets the -1 for one run (0 gives the old behaviour, -3 is the lowest).RX_VK_UPSCALE_LOD_BIAS=0still turns the whole bias off.upscaler_rows::upscale_lod_bias_for, checked bytests/test_upscaler_rows.cpp(no game or GPU needed). The readme's texture-detail note is updated.Before / after
All shots are the game's own frames at the 2560x1440 output, same save and same spot (Kokiri Forest, standing still), crops scaled 2x with nearest-neighbour. Each image is four tiles, left to right:
Images:
Stone path, fine texture:
Grass field:
The wooden fence on the house:
DLAA with the new bias, next to native 100%:
I measured detail as the RMS of the luma Laplacian over fixed crops (higher is more detail). DLSS Quality:
Frame-to-frame change with the camera still stayed at 0.13 to 0.18 (out of 255) before and after, so the extra texture detail did not bring new shimmer. DLAA with the new bias measured 0.09 to 0.13.
This is a real but modest improvement. DLSS Quality is still softer than native and than the game's own upscaler, which visibly sharpens its output. The Sharpness row (around 80% for DLSS, as the readme says) is still the way to match that.
Checked and ruled out
I tested these with the same setup and changed nothing for them:
Tested
python -I -B tests/test_upscaler_rows.py(new checks for the bias rule: NVIDIA's formula at each fixed share, DLAA, Auto, the old behaviour at offset 0, FSR unchanged, and no bias for the game's own, Off and FSR 4 native AA)Not tested
The frame-rate cost. Sampling one mip step finer reads more texture data; NVIDIA's guide expects this to be small, but it was not timed here (a timed before/after with DLSS Quality is queued and will be added).
Windows
Balanced, Performance, Ultra Performance, and Auto with DLSS (the formula is the same; only Quality was captured)
A before shot of DLAA (only after)
Areas other than Kokiri Forest, and long play for moiré on high-frequency textures (NVIDIA warns a bias can add it;
RX_VK_DLSS_LOD_OFFSETmakes it easy to back off)Presets other than K
Follow-up on the cost of the finer mip, which the PR listed as not measured: the GPU time doesn't change.
RX_VK_DLSS_LOD_OFFSET=0(before this PR)Setup: DLSS Quality 67% (1707x960 → 2560x1440), preset K, RTX 3090, Linux, headless, Kokiri Forest standing still, about 25 s each, the same build with only the switch changed. The headless runs were CPU-bound and noisy (19–34 fps either way), so no frame-rate difference can be pinned on the bias in either direction. A windowed run with a frame log would be needed for a real median and p99.
github-sync referenced this pull request2026-11-12 06:22:54 +00:00