From 80a751f1b5028c64e02c904522bc6ee2bc19aa9b Mon Sep 17 00:00:00 2001 From: Faerbit Date: Thu, 4 Dec 2014 13:26:06 +0100 Subject: [PATCH] Improving bias on slopes. --- Shader/phong.fsh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Shader/phong.fsh b/Shader/phong.fsh index d1b4031..74564e1 100644 --- a/Shader/phong.fsh +++ b/Shader/phong.fsh @@ -59,7 +59,8 @@ void main() } // shadows - float bias = 0.001; + float bias = 0.001*tan(acos(clamp(dot(vNormal, -directionalLightVector), 0.0, 1.0))); + bias = clamp(bias, 0.0, 0.01); vec3 biasedShadowCoord = vec3(shadowCoord); biasedShadowCoord.z = shadowCoord.z - bias; float visibility = 1.0;