From fc42ef3fe4b7f08059878709ac930916005389b8 Mon Sep 17 00:00:00 2001 From: Stuart Buchanan <stuart_d_buchanan@yahoo.co.uk> Date: Thu, 21 Oct 2021 21:34:53 +0100 Subject: [PATCH] WS30: Include ambient light in ALS fragment shader Previously only the diffuse term was considered in the fragment shader, leading to very dark scenery and deep shadows. Now the ambient light term is also included making the scenery much closer to the way it should be lit. --- Shaders/ws30-ALS.frag | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shaders/ws30-ALS.frag b/Shaders/ws30-ALS.frag index 8432b863f..a65c1819e 100644 --- a/Shaders/ws30-ALS.frag +++ b/Shaders/ws30-ALS.frag @@ -119,7 +119,7 @@ void main() vec4 mat_diffuse = texture(diffuseArray, index); vec4 mat_specular = texture(specularArray, index); - vec4 color = mat_diffuse * NdotL * gl_LightSource[0].diffuse; + vec4 color = gl_Color + mat_diffuse * NdotL * gl_LightSource[0].diffuse; // Testing code: // Use rlc even when looking up textures to recreate the extra performance hit