From faf548d3ee543a01287e20beaddd44e83311e8f2 Mon Sep 17 00:00:00 2001 From: Faerbit Date: Wed, 19 Nov 2014 01:58:25 +0100 Subject: [PATCH] Now using built-in exp function. --- Shader/phong.fsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shader/phong.fsh b/Shader/phong.fsh index afc2759..b76a2db 100644 --- a/Shader/phong.fsh +++ b/Shader/phong.fsh @@ -40,7 +40,7 @@ void main() // only take lights into account with meaningful contribution if (distance > 0.001f) { vec3 lightVector = normalize(lightSources[i]-vec3(fragPosition)); - float intensity = clamp(pow(2.718,(-(1/lightIntensities[i])*distance)), 0.0, 1.0); + float intensity = clamp(exp(-(1/lightIntensities[i])*distance), 0.0, 1.0); diffuseColor += clamp(dot(normalize(vNormal), lightVector) *diffuseFactor*intensity*lightColors[i], 0.0, 1.0); vec3 cameraVector = normalize(camera - vec3(fragPosition));