mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 09:19:58 -04:00
Add the -1 texture LOD bias NVIDIA asks for while DLSS or FSR runs with jitter.
The bias on the scene's tiled material textures was log2(render / output) alone, so DLAA got 0 and Quality -0.58. NVIDIA's DLSS guide asks for log2(render / output) - 1 on top of the game's own bias: the jittered frames the upscaler accumulates resolve detail a level finer than one frame shows. The -1 now comes with the jitter (dlaa_jitter, on by default): DLAA gets -1, Quality -1.58, Performance -2, for DLSS and FSR 3.1 and 4 alike, which share the bias. Without jitter it stays as it was, where a sharper level would shimmer. Which samplers take it, and the clamp to the device's limit, are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -381,10 +381,10 @@ void res_init(void) {
|
||||
double wide_dlss_share(void); // widescreen.c: the mode's share of the picture (1 DLAA), 0 off
|
||||
|
||||
// DLSS upscaling: textures are sampled for the output's resolution, not the scene's (NVIDIA's DLSS guide: a mip bias
|
||||
// of log2(render / output)), so their detail survives the scaling. 0 without a DLSS mode. Without the output and scene
|
||||
// patch sets (Ocarina) the scene's share is widescreen.c's, which follows the mode and the upscaler while the game runs;
|
||||
// R.dlss_k stays the mode at start there (res_dlss_mode moves it only once res_init has switched the sets on). vk_dlaa.c
|
||||
// dlss_mode asks again at every mode change.
|
||||
// of log2(render / output), and -1 more with the jitter, which vk_dlaa.c dlss_mode adds), so their detail survives the
|
||||
// scaling. 0 without a DLSS mode. Without the output and scene patch sets (Ocarina) the scene's share is widescreen.c's,
|
||||
// which follows the mode and the upscaler while the game runs; R.dlss_k stays the mode at start there (res_dlss_mode
|
||||
// moves it only once res_init has switched the sets on). vk_dlaa.c dlss_mode asks again at every mode change.
|
||||
float res_dlss_lod_bias(void) {
|
||||
decide();
|
||||
double k = res_adjustable() ? R.dlss_k : wide_dlss_share();
|
||||
|
||||
@@ -1609,14 +1609,20 @@ void vk_dlaa_draw(VkExec *ex) {
|
||||
}
|
||||
}
|
||||
|
||||
// NX2NAVI_DLAA_JITTER=0 (test): no jitter. Read once.
|
||||
static int jitter_on(void) {
|
||||
static int on = -1;
|
||||
if (on < 0) on = rt_knob("DLAA_JITTER", "1");
|
||||
return on;
|
||||
}
|
||||
|
||||
// The jitter moves on right after DLAA ran, not at the present: the replay can record the next frame's scene before
|
||||
// the present of this one is handled, and a step taken there landed in the middle of a frame (worse after an off/on
|
||||
// switch, which shifted that order). Jitter needs a frame DLSS ran on; a frame without the DLAA point stops it.
|
||||
// The sequence is as long as NVIDIA's DLSS guide asks for the upscaling ratio, 8 x (output / scene)^2 phases (18 in
|
||||
// Quality, 24 in Balanced, 32 in Performance, 72 in Ultra Performance), and 16 at least, the length DLAA has used from the start.
|
||||
static void next_jitter(uint32_t w, uint32_t ow) {
|
||||
static int nj = -1;
|
||||
if (nj < 0) nj = !rt_knob("DLAA_JITTER", "1"); // NX2NAVI_DLAA_JITTER=0: no jitter (test)
|
||||
int nj = !jitter_on();
|
||||
double r = w ? (double)ow / w : 1.0;
|
||||
uint32_t phases = (uint32_t)ceil(8.0 * r * r - 1e-6);
|
||||
if (phases < 16) phases = 16;
|
||||
@@ -2131,7 +2137,13 @@ void vk_dlaa_pass(VkExec *ex) {
|
||||
}
|
||||
|
||||
// NX2NAVI_DLSS, read at each present (the menu switches it live): the scene size of the mode (resolution.c) and the
|
||||
// texture bias that goes with it while DLSS runs.
|
||||
// texture bias that goes with it while DLSS or FSR 3.1 runs. NVIDIA's DLSS guide asks for log2(render / output) - 1 on
|
||||
// top of the game's own bias: the render scale's part (res_dlss_lod_bias) samples textures for the output's resolution,
|
||||
// and the -1 sharper still, since the jittered frames DLSS accumulates resolve the detail one level finer: -1 at DLAA,
|
||||
// -1.58 in Quality (67 %), -2 in Performance. The -1 comes only with the jitter (jitter_on): without it the same pixel
|
||||
// samples the same spot every frame, and a sharper level would shimmer instead. The sampler clamps the sum to the
|
||||
// device's limit (vk_texture.c make_sampler).
|
||||
#define JITTER_LOD_BIAS (-1.0f)
|
||||
static void dlss_mode(void) {
|
||||
static char mode[32];
|
||||
static int bias_on = -1;
|
||||
@@ -2143,7 +2155,8 @@ static void dlss_mode(void) {
|
||||
bias_on = -1;
|
||||
}
|
||||
int b = dl_active();
|
||||
if (b != bias_on) bias_on = b, vk_sampler_dlss_bias(b ? res_dlss_lod_bias() : 0.0f);
|
||||
if (b != bias_on)
|
||||
bias_on = b, vk_sampler_dlss_bias(b ? res_dlss_lod_bias() + (jitter_on() ? JITTER_LOD_BIAS : 0.0f) : 0.0f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user