Add soft sun shadows (PCSS) through a translator patch

The deferred lighting shaders take the sun shadow as four explicit-LOD compares on the cascade array. Translator patch
0010 turns every explicit-LOD compare on a 2D array texture into a PCSS lookup when the support buffer's new pcss
field has x above 0: eight raw depth fetches within pcss.w find the blockers, (receiver - blocker) * pcss.x gives the
penumbra width clamped to pcss.y..pcss.z, and eight compares on a disc of that radius average to the result. With x at
0 the original single compare runs behind a branch. Radii are in UV, so they hold at any shadow_scale.

The support buffer grows to 1424 bytes; support_fill writes the field from pcss (percent of the default width, 0 to
200, default 0; TOTK_PCSS_K overrides the factor at 100 percent, default 0.5). build_xlate.py expects ten patches. The
setting is in totk.ini.example and on the Screen tab of the menu (English and Russian).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
itaskaev2andClaude Opus 5.5 committed 2026-10-30 16:00:23 +01:00
1 parent 4af60604de
commit 24571ec0b0
8 files changed
+174 -6

No files matched your search

+6
View File
@@ -70,6 +70,9 @@ static const char *const text_en[UI_TEXT_COUNT] = {
[UI_MENU_SHADOW_SCALE] = "Shadow resolution",
[UI_MENU_SHADOW_SCALE_DESC] = "Draws the sun's shadow maps this many times larger on each side than the game's 960x960: "
"sharper shadow edges and leaf shadows. Takes effect at the next start.",
[UI_MENU_PCSS] = "Soft shadows",
[UI_MENU_PCSS_DESC] = "Sun shadows sharp where an object meets the ground and softer the further the shadow falls "
"(PCSS). 0 keeps the game's filter. Takes effect at the next start.",
[UI_MENU_CONTACT_SHADOWS] = "Contact shadows",
[UI_MENU_CONTACT_SHADOWS_DESC] = "Small sun shadows the shadow maps miss: at feet, under stones, in grass and creases. "
"Traced on the screen after lighting. Takes effect at the next start.",
@@ -302,6 +305,9 @@ static const char *const text_ru[UI_TEXT_COUNT] = {
[UI_MENU_SHADOW_SCALE] = "Разрешение теней",
[UI_MENU_SHADOW_SCALE_DESC] = "Карты теней от солнца рисуются во столько раз больше по каждой стороне, чем 960x960 "
"самой игры: края теней и тени листвы чётче. Действует после перезапуска.",
[UI_MENU_PCSS] = "Мягкие тени",
[UI_MENU_PCSS_DESC] = "Тени от солнца резкие там, где предмет касается земли, и мягче, чем дальше падает тень "
"(PCSS). 0 оставляет фильтр игры. Действует после перезапуска.",
[UI_MENU_CONTACT_SHADOWS] = "Контактные тени",
[UI_MENU_CONTACT_SHADOWS_DESC] = "Мелкие тени от солнца, которых нет на картах теней: у ног, под камнями, в траве и "
"складках. Считаются по экрану после освещения. Действует после перезапуска.",