diff options
Diffstat (limited to 'source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl')
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl b/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl index fa02bee45b7..fe6a828f369 100644 --- a/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/shadow_accum_frag.glsl @@ -19,7 +19,7 @@ void main() float depth = texelFetch(depthBuffer, texel, 0).r; if (depth == 1.0f) { /* Early exit background does not receive shadows */ - fragColor.r = 1.0; + fragColor.r = 0.0; return; } @@ -40,6 +40,7 @@ void main() vec3 worldPosition = transform_point(ViewMatrixInverse, viewPosition); vec3 true_normal = normalize(cross(dFdx(viewPosition), dFdy(viewPosition))); + vec3 N = normal_view_to_world(true_normal); for (int i = 0; i < MAX_LIGHT && i < laNumLight; i++) { LightData ld = lights_data[i]; @@ -48,8 +49,9 @@ void main() l_vector.xyz = ld.l_position - worldPosition; l_vector.w = length(l_vector.xyz); + float light_input = smoothstep(0.2, -0.2, -dot(N, normalize(l_vector.xyz))); float l_vis = light_shadowing( - ld, worldPosition, viewPosition, tracing_depth, true_normal, rand.x, true, 1.0); + ld, worldPosition, viewPosition, tracing_depth, true_normal, rand.x, true, light_input); accum_light += l_vis; } |