From b7096d9f2e14f100c3f400bc74797a56084f66f7 Mon Sep 17 00:00:00 2001 From: Imbris Date: Sun, 5 Jun 2022 16:33:55 -0400 Subject: [PATCH] Scale shadow grid to multiple texels per grid cell to make it easier to examine --- assets/voxygen/shaders/terrain-frag.glsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/voxygen/shaders/terrain-frag.glsl b/assets/voxygen/shaders/terrain-frag.glsl index 5dc0e563fb..034c98edcb 100644 --- a/assets/voxygen/shaders/terrain-frag.glsl +++ b/assets/voxygen/shaders/terrain-frag.glsl @@ -266,7 +266,11 @@ void main() { vec3 two_up = f_pos + offset_two; vec3 two_down = f_pos - offset_two; - vec2 shadowTexSize = textureSize(sampler2D(t_directed_shadow_maps, s_directed_shadow_maps), 0); + // Adjust this to change the size of the grid cells relative to the + // number of shadow texels + float grid_cell_to_texel_ratio = 32.0; + + vec2 shadowTexSize = textureSize(sampler2D(t_directed_shadow_maps, s_directed_shadow_maps), 0) / grid_cell_to_texel_ratio; vec4 one_up_shadow_tex = texture_mat * vec4(one_up, 1.0); vec2 oust_snap = floor(one_up_shadow_tex.xy * shadowTexSize / one_up_shadow_tex.w);