Scale the slope-scaled depth bias with the shadow map scale, so the larger maps keep the bias the game asked for.

The slope term is a bias per unit of depth slope across one pixel of the target. A shadow map made k times larger on
each side (shadow_scale 2 to 4) has 1/k of the slope across each texel, so the game's factor alone gave k times less
bias on sloped surfaces than at the game's own size, which is what shows as acne. vk_exec_draw.c slope_bias
multiplies the factor by the pass's scale for both the direct draws (record_fixed) and the queued mesh draws; the
constant term counts the depth format's smallest steps and keeps its value. Nothing changes at shadow_scale 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
FIocker
2026-11-12 17:22:34 +01:00
committed by chrg6
parent a74f7695c8
commit 58efccd883
3 changed files with 15 additions and 5 deletions

View File

@@ -468,7 +468,8 @@
# Shadow map resolution: the game's sun cascades are 960x960 (and its static shadow maps 1440 and 720) whatever the game
# resolution; 2 to 4 draws them that many times larger on each side, for sharper shadows. 1 = the game's. The game's
# shadow edge filter is narrowed by the same factor (translator patch 0011), so close shadow edges don't look doubled.
# shadow edge filter is narrowed by the same factor (translator patch 0011), so close shadow edges don't look doubled,
# and the game's slope-scaled depth bias grows by it, so the larger maps don't shadow the surfaces they are cast on.
# Read at start.
# shadow_scale = 1
# Sun shadow cascade range in percent of the game's (its cascades end at 20, 40, 80 and 160 m), 50 to 400: higher moves