fix self shadows
This commit is contained in:
parent
075f1e892a
commit
28a9b5e03e
@ -185,6 +185,14 @@ float ShadowCalculation(vec4 fragPosLightSpace, vec3 lightDir, vec3 normal){
|
|||||||
shadow = 0.0;
|
shadow = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//calculate dot product, if it is >0 we know they're parallel-ish therefore should disregard the shadow mapping
|
||||||
|
//ie the fragment is already facing away from the light source
|
||||||
|
float dotprod = dot(normalize(lightDir),normalize(normal));
|
||||||
|
|
||||||
|
if(dotprod > 0.0){
|
||||||
|
shadow = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
// shadow = currentDepth;
|
// shadow = currentDepth;
|
||||||
|
|
||||||
return shadow;
|
return shadow;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user