Darken only sunlit pixels with contact shadows

The half-resolution lighting pass the composite reads keeps the sun's visibility in its first target's alpha: 1 in
the sun, 0 in the shadow maps' shadow and everywhere underground. vk_contact.c finds that pass (eight targets at half
the scene size, the first RGBA8) and contact_shadow.comp scales its darkening by that alpha, so a contact shadow takes
away direct sunlight only and caves no longer turn flat. Without that pass in the frame the old behaviour stays.
TOTK_CONTACT_DEBUG=2 shows the visibility in grey.

Carried onto dev from #439: the march is now planned by the scan (vk_contact_plan) and recorded from a VkExecJob, so
the lighting target travels in the job's new sun field, and the factor multiplies the facing-the-sun factor of the
back-face fix.

Co-Authored-By: itaskaev2 <165683571+itaskaev2@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
authored and itaskaev2 committed 2026-11-15 17:34:42 +01:00
1 parent 6151ac4fbc
commit 581c1ecdef
5 files changed
+276 -215

No files matched your search

+2
View File
@@ -69,6 +69,8 @@ typedef struct VkExecJob {
int chunk; // vk_exec.c: the chunk that holds the op
VkExecTarget scene, depth; // contact: the scene colour and the linear depth; DLSS: the light target to copy
// (mask) or the scaling pass's target (evaluation; no tex: in place)
VkExecTarget sun; // contact: the half-resolution lighting target whose alpha is sun visibility
// (no img: none in this frame)
float pc[16]; // the march's push constants
} VkExecJob;