Commit d226d6a3 authored by Florian Oetke's avatar Florian Oetke
Browse files

added out-of-bounds check to directional light shadows

parent 80a959a0
Pipeline #2328 passed with stage
in 4 minutes and 4 seconds
......@@ -88,6 +88,9 @@ float sample_shadowmap(vec3 view_pos) {
vec4 lightspace_pos = model_uniforms.model * vec4(view_pos, 1.0);
lightspace_pos /= lightspace_pos.w;
lightspace_pos.xy = lightspace_pos.xy * 0.5 + 0.5;
if(lightspace_pos.x<0 || lightspace_pos.y<0 || lightspace_pos.x>=1 || lightspace_pos.y>=1)
return 1.0;
float shadowmap_size = textureSize(sampler2D(shadowmaps[shadowmap], shadowmap_depth_sampler), 0).x;
float light_size = model_uniforms.light_data.r / 800.0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment