diff --git a/libs/video/renderer/vulkan/shader/lighting_cascade.frag b/libs/video/renderer/vulkan/shader/lighting_cascade.frag index 2d192674e..6a6f8e354 100644 --- a/libs/video/renderer/vulkan/shader/lighting_cascade.frag +++ b/libs/video/renderer/vulkan/shader/lighting_cascade.frag @@ -19,4 +19,17 @@ shadow (uint map_id, uint layer, uint mat_id, vec4 pos, vec3 lpos) return texture (shadow_map[map_id], vec4 (uv, layer + ind, depth)); } +vec4 +debug_shadow (vec4 pos) +{ + float fd = pos.w; + uint ind = fd > CascadeDepths[1] + ? fd > CascadeDepths[0] ? 0 : 1 + : fd > CascadeDepths[2] ? 2 : 3; + ind += 1; + return vec4 (ind & 1, ind & 2, ind & 4, 1); +} + +//#define DEBUG_SHADOW(p) debug_shadow(p) + #include "lighting_main.finc" diff --git a/libs/video/renderer/vulkan/shader/lighting_main.finc b/libs/video/renderer/vulkan/shader/lighting_main.finc index 4a32c9b85..86b4a0073 100644 --- a/libs/video/renderer/vulkan/shader/lighting_main.finc +++ b/libs/video/renderer/vulkan/shader/lighting_main.finc @@ -66,6 +66,9 @@ main (void) if (fog.w > 0) { col = FogTransmit (col, fog, r[1]); } +#ifdef DEBUG_SHADOW + col = DEBUG_SHADOW(p); +#endif light += I * col.w * col.xyz; } //light = max (light, minLight);