X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=shaderlib%2Fshadow.glsl;h=049ec188e5a97a67a6e42a6a87e5e3c315e284df;hb=c26b36bee465f16e3e3ed1b01ad613e7d2017102;hp=d6e2b385f8955009abf737d998fbe7dd984f8996;hpb=57588abbefc8f0162332ac2310c69b62a14b2404;p=libs%2Fgl.git diff --git a/shaderlib/shadow.glsl b/shaderlib/shadow.glsl index d6e2b385..049ec188 100644 --- a/shaderlib/shadow.glsl +++ b/shaderlib/shadow.glsl @@ -9,13 +9,13 @@ struct ShadowParameters vec2 bias; }; -uniform ShadowMap +layout(set=0) uniform ShadowMap { ShadowParameters shadows[max_lights]; mat4 shd_world_matrix[max_lights*4]; }; -uniform sampler2DShadow shadow_map; +layout(set=0) uniform sampler2DShadow shadow_map; layout(constant_id=auto) const bool use_shadow_map = false; @@ -52,7 +52,7 @@ virtual float get_shadow_factor(int index, vec4 world_pos) return 1.0; vec4 region = shadows[index].region; - float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, shadow_coord.z)); + float shadow_sample = texture(shadow_map, vec3(shadow_coord.xy*region.zw+region.xy, min(shadow_coord.z, 1.0))); return mix(1.0, shadow_sample, shadows[index].darkness); } else