From 38d5d141575dc4e4c1c20ce79c4fead28ea798ba Mon Sep 17 00:00:00 2001 From: Bart Trzynadlowski Date: Mon, 4 Apr 2016 04:32:10 +0000 Subject: [PATCH] Clamping diffuse+ambient light intensity to 1.0 (legacy engine) --- Src/Graphics/Legacy3D/Shaders/Vertex.glsl | 2 +- Src/Graphics/Legacy3D/Shaders3D.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/Graphics/Legacy3D/Shaders/Vertex.glsl b/Src/Graphics/Legacy3D/Shaders/Vertex.glsl index 5dbbb48..8489abd 100644 --- a/Src/Graphics/Legacy3D/Shaders/Vertex.glsl +++ b/Src/Graphics/Legacy3D/Shaders/Vertex.glsl @@ -129,7 +129,7 @@ void main(void) sunFactor = max(dot(sunVector,viewNormal),0.0); // Total light intensity: sum of all components - fsLightIntensity *= (sunFactor*lighting[1].x+lighting[1].y); + fsLightIntensity *= min(1.0,(sunFactor*lighting[1].x+lighting[1].y)); /* * Specular Lighting diff --git a/Src/Graphics/Legacy3D/Shaders3D.h b/Src/Graphics/Legacy3D/Shaders3D.h index befcbe6..4a9c433 100644 --- a/Src/Graphics/Legacy3D/Shaders3D.h +++ b/Src/Graphics/Legacy3D/Shaders3D.h @@ -164,7 +164,7 @@ static const char vertexShaderSource[] = "\t\tsunFactor = max(dot(sunVector,viewNormal),0.0);\n" "\t\t\n" "\t\t// Total light intensity: sum of all components\n" -"\t\tfsLightIntensity *= (sunFactor*lighting[1].x+lighting[1].y);\n" +"\t\tfsLightIntensity *= min(1.0,(sunFactor*lighting[1].x+lighting[1].y));\n" "\t\t\n" "\t\t/*\n" "\t\t * Specular Lighting\n"