diff --git a/Effects/light-point.eff b/Effects/light-point.eff index 5c2f93a87..ae20e6d56 100644 --- a/Effects/light-point.eff +++ b/Effects/light-point.eff @@ -68,6 +68,11 @@ position true + + Ambient + float-vec4 + ambient + Diffuse float-vec4 diff --git a/Effects/light-spot.eff b/Effects/light-spot.eff index cd872851f..6585e9aee 100644 --- a/Effects/light-spot.eff +++ b/Effects/light-spot.eff @@ -74,6 +74,11 @@ direction true + + Ambient + float-vec4 + ambient + Diffuse float-vec4 diff --git a/Shaders/light-point.frag b/Shaders/light-point.frag index 7f37f046c..f71a40600 100644 --- a/Shaders/light-point.frag +++ b/Shaders/light-point.frag @@ -6,6 +6,7 @@ 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; @@ -46,8 +47,9 @@ 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(Idiff.rgb + Ispec, 1.0); + gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0); } diff --git a/Shaders/light-spot.frag b/Shaders/light-spot.frag index 9194a56a7..7371eec6f 100644 --- a/Shaders/light-spot.frag +++ b/Shaders/light-spot.frag @@ -7,6 +7,7 @@ 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; @@ -58,8 +59,9 @@ 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(Idiff.rgb + Ispec, 1.0); + gl_FragColor = vec4(Iamb.rgb + Idiff.rgb + Ispec, 1.0); }