From e442e37ec3b6189eb5d9306c5f694c82f66f9d89 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Mon, 16 Apr 2012 08:29:33 +0200 Subject: [PATCH] Remove ambient component of additional lights It creates artifacts at edges of light volumes and should come from the main light source (sun and moon) anyway --- Effects/light-point.eff | 5 ----- Effects/light-spot.eff | 5 ----- Shaders/light-point.frag | 4 +--- Shaders/light-spot.frag | 4 +--- 4 files changed, 2 insertions(+), 16 deletions(-) diff --git a/Effects/light-point.eff b/Effects/light-point.eff index ae20e6d56..5c2f93a87 100644 --- a/Effects/light-point.eff +++ b/Effects/light-point.eff @@ -68,11 +68,6 @@ position true - - Ambient - float-vec4 - ambient - Diffuse float-vec4 diff --git a/Effects/light-spot.eff b/Effects/light-spot.eff index 6585e9aee..cd872851f 100644 --- a/Effects/light-spot.eff +++ b/Effects/light-spot.eff @@ -74,11 +74,6 @@ direction true - - Ambient - float-vec4 - ambient - Diffuse float-vec4 diff --git a/Shaders/light-point.frag b/Shaders/light-point.frag index f71a40600..7f37f046c 100644 --- a/Shaders/light-point.frag +++ b/Shaders/light-point.frag @@ -6,7 +6,6 @@ uniform sampler2D normal_tex; uniform sampler2D color_tex; uniform sampler2D spec_emis_tex; uniform vec4 LightPosition; -uniform vec4 Ambient; uniform vec4 Diffuse; uniform vec4 Specular; uniform vec3 Attenuation; @@ -47,9 +46,8 @@ void main() { float nDotHV = max(0.0, dot(normal, halfVector)); vec4 color = texture2D( color_tex, coords ); - vec4 Iamb = Ambient * color * att; vec4 Idiff = Diffuse * color * att * nDotVP; vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb; - gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0); + gl_FragColor = vec4(Idiff.rgb + Ispec, 1.0); } diff --git a/Shaders/light-spot.frag b/Shaders/light-spot.frag index 7371eec6f..9194a56a7 100644 --- a/Shaders/light-spot.frag +++ b/Shaders/light-spot.frag @@ -7,7 +7,6 @@ uniform sampler2D color_tex; uniform sampler2D spec_emis_tex; uniform vec4 LightPosition; uniform vec4 LightDirection; -uniform vec4 Ambient; uniform vec4 Diffuse; uniform vec4 Specular; uniform vec3 Attenuation; @@ -59,9 +58,8 @@ void main() { float nDotHV = max(0.0, dot(normal, halfVector)); vec4 color = texture2D( color_tex, coords ); - vec4 Iamb = Ambient * color * att; vec4 Idiff = Diffuse * color * att * nDotVP; vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb; - gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0); + gl_FragColor = vec4(Idiff.rgb + Ispec, 1.0); }