diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-10-28 21:24:56 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-10-28 23:48:22 +0300 |
commit | 61e4e3178d4a496a416c360565afb8bbe7592422 (patch) | |
tree | ed24d2505fbc7fb6e3f4d378dec9823fc3dc7cbe | |
parent | f15afc47ed5380bba5a42555451d88be51d70756 (diff) |
Eevee: Fix contact shadow creating to overshadowing
This was because the shadow rays could be generated below the geometric
normal.
-rw-r--r-- | source/blender/draw/engines/eevee/shaders/lamps_lib.glsl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl index 6f7a2f9bb09..b33f1a0572e 100644 --- a/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lamps_lib.glsl @@ -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; |