mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-24 21:55:57 +00:00
Add screen-space contact shadows
TotK fills a full-resolution G-buffer with a B10G11R11 scene colour, an R32F linear depth and a D32F depth, lights it in half resolution, and composites the lighting into the scene colour in one pass whose only target is that colour, with a D16 class depth. vk_contact.c recognises both passes, and when the pass after the composite begins (or a dispatch or copy comes first) runtime/shaders/contact_shadow.comp marches each pixel 16 steps toward the sun through the linear depth and darkens the scene colour where nearby geometry blocks the ray: the small shadows at feet, under stones and in grass that the shadow maps miss. Transparent surfaces, the sky and post-processing come after. The projection, far plane and sun direction come from the fragment stage's 0x940-byte camera block (c4): c4[7].x, c4[8].y, c4[14].y, and the first cascade's depth row c4[44].xyz, whose negation points toward the sun. Scene colour images get STORAGE usage while the setting is on. contact_shadows (percent strength, default 0) is in totk.ini.example and on the Screen tab of the menu (English and Russian). TOTK_CONTACT_DEBUG=1 shows the shadow factor in grey instead of the frame. It costs about 0.45 ms per frame at a 3840x2160 scene on an RTX 4080 SUPER. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
386e70453b
commit
4af60604de
15 files changed
+440
-3
No files matched your search
@@ -422,6 +422,7 @@ void vk_exec_barrier(VkExec *ex) { barrier_to(ex, NULL, NULL, 0); }
|
||||
void vk_exec_pass_begin(VkExec *ex) {
|
||||
if (ex->in_pass) return;
|
||||
resolve_rt(ex);
|
||||
vk_contact_pass_begin(ex);
|
||||
// Learned targets (VkTexImage.fb_learned) are attached in the feedback layout
|
||||
VkImage want[9];
|
||||
VkImageAspectFlags wasp[9];
|
||||
|
||||
Reference in new issue
Block a user