Series S stretch: an opt-in Catmull-Rom sample with contrast-adaptive sharpening (VICTORY_UPSCALE_SHARP; stacked on #188) #1177

Open
Exopus-0x65f7ad0 wants to merge 11 commits from upstream-pr/1180 into main
Exopus-0x65f7ad0 commented 2026-11-25 23:02:40 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by Exopus-0x65f7ad0 on 2026-11-25T23:02:40Z.


Stacked on #188 (its commits come first; the two commits after them are this PR's). Opt-in, so nothing changes without the switch.

Problem

In the Series S profile the title renders at 1280x720 and asks its upscaler for 1920x1080. #188 answers that dispatch with a plain bilinear stretch, and its own comment says so: "an image, not the upscaler's quality". On screen the picture is soft, and fine detail in the distance, through window glass and on posters smears.

Change

VICTORY_UPSCALE_SHARP=<0..1>, off when unset or 0 (#188's bilinear stretch, byte for byte the same pass).

When on, each output texel goes through four steps:

  1. It is a Catmull-Rom (bicubic) sample of the rendered region, taken with nine bilinear taps and kept inside the rendered rectangle as #188 does.
  2. It is clamped to its four source neighbours, so the bicubic lobes do not ring.
  3. It is sharpened by its neighbourhood's contrast, as AMD's CAS does: -1 / lerp(8, 5, SHARP) lobes, scaled down where the neighbourhood already spans the range.
  4. Steps 2-3 run in a reversible tone-mapped space, c / (1 + max(c)) and back, because the colour input is HDR.

The result is never brighter than its brightest neighbour. Without that bound, backlit hair showed bright specks: a value near 1 in tone-mapped space becomes a very large HDR value on the way back.

The shader stays one compute pass. SHARP is a #define set when the pass is created, so the switch costs nothing per frame.

Tested

  • over::tests::the_sharpened_stretch_compiles_and_its_switch_parses: the switch parses and stays in bounds, and both forms (0 and 0.6) compile with FXC cs_5_1. The existing stretch tests still pass.
  • In game, Series S, RTX 5060 Ti 8 GB, Windows 11, fork main d510ee4 plus a stack of open PRs, VICTORY_UPSCALE_SHARP=0.6:
    • first room: frame time unchanged within run-to-run noise (7.8 fps in that run);
    • posters, the window's mesh and brick edges visibly sharper than with the bilinear stretch;
    • no ringing or specks after the bound;
    • opening cutscene close-ups (skin, eyes, hair) clean.

It is still a spatial filter: no temporal accumulation and no use of the depth or motion inputs. #86 / #730 (a real upscaler) remain the better long-term answer. This is a cheap step up from the stretch until then.

No game data in this PR (no captures, hashes, addresses or logs).

🤖 Generated with Claude Code

<!-- greyfinch-sync:fxceless/victory-fork:issue:6615531834 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/1180). Originally posted by [Exopus-0x65f7ad0](https://github.com/Exopus-0x65f7ad0) on 2026-11-25T23:02:40Z. --- **Stacked on #188** (its commits come first; the two commits after them are this PR's). Opt-in, so nothing changes without the switch. ## Problem In the Series S profile the title renders at 1280x720 and asks its upscaler for 1920x1080. #188 answers that dispatch with a plain bilinear stretch, and its own comment says so: "an image, not the upscaler's quality". On screen the picture is soft, and fine detail in the distance, through window glass and on posters smears. ## Change `VICTORY_UPSCALE_SHARP=<0..1>`, off when unset or 0 (#188's bilinear stretch, byte for byte the same pass). When on, each output texel goes through four steps: 1. It is a **Catmull-Rom (bicubic) sample** of the rendered region, taken with nine bilinear taps and kept inside the rendered rectangle as #188 does. 2. It is **clamped to its four source neighbours**, so the bicubic lobes do not ring. 3. It is **sharpened by its neighbourhood's contrast**, as AMD's CAS does: `-1 / lerp(8, 5, SHARP)` lobes, scaled down where the neighbourhood already spans the range. 4. Steps 2-3 run in a **reversible tone-mapped space**, `c / (1 + max(c))` and back, because the colour input is HDR. The result is **never brighter than its brightest neighbour**. Without that bound, backlit hair showed bright specks: a value near 1 in tone-mapped space becomes a very large HDR value on the way back. The shader stays one compute pass. `SHARP` is a `#define` set when the pass is created, so the switch costs nothing per frame. ## Tested - `over::tests::the_sharpened_stretch_compiles_and_its_switch_parses`: the switch parses and stays in bounds, and both forms (0 and 0.6) compile with FXC `cs_5_1`. The existing stretch tests still pass. - In game, Series S, RTX 5060 Ti 8 GB, Windows 11, fork `main` d510ee4 plus a stack of open PRs, `VICTORY_UPSCALE_SHARP=0.6`: - first room: frame time unchanged within run-to-run noise (7.8 fps in that run); - posters, the window's mesh and brick edges visibly sharper than with the bilinear stretch; - no ringing or specks after the bound; - opening cutscene close-ups (skin, eyes, hair) clean. It is still a spatial filter: no temporal accumulation and no use of the depth or motion inputs. #86 / #730 (a real upscaler) remain the better long-term answer. This is a cheap step up from the stretch until then. No game data in this PR (no captures, hashes, addresses or logs). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1180:upstream-pr/1180'
git switch 'upstream-pr/1180'

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 'upstream-pr/1180'
git switch 'upstream-pr/1180'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1180'
git switch 'upstream-pr/1180'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1180'
git switch 'main'
git merge --squash 'upstream-pr/1180'
git switch 'main'
git merge --ff-only 'upstream-pr/1180'
git switch 'main'
git merge 'upstream-pr/1180'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
fxceless/victory-fork!1177
No description provided.