Eevee: Fix contact shadow creating to overshadowing

This was because the shadow rays could be generated below the geometric
normal.
This commit is contained in:
Clément Foucault 2018-10-28 19:24:56 +01:00
parent f15afc47ed
commit 61e4e3178d
Notes: blender-bot 2023-02-14 05:03:36 +01:00
Referenced by issue #63627, Light Leak between normal shadows and contact shadows in Eevee
Referenced by issue #57752, EEVEE and backlighting
1 changed files with 4 additions and 0 deletions

View File

@ -226,6 +226,10 @@ float light_visibility(LightData ld, vec3 W,
vec3 ray_ori = viewPosition;
if (dot(viewNormal, ray_dir) <= 0.0) {
return vis;
}
float bias = 0.5; /* Constant Bias */
bias += 1.0 - abs(dot(viewNormal, ray_dir)); /* Angle dependent bias */
bias *= gl_FrontFacing ? data.sh_contact_offset : -data.sh_contact_offset;