1
0
Fork 0

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
This commit is contained in:
Frederic Bouvier 2012-04-16 08:29:33 +02:00
parent 7cb9997d4e
commit e442e37ec3
4 changed files with 2 additions and 16 deletions

View file

@ -68,11 +68,6 @@
<value type="vec4d"><use>position</use></value> <value type="vec4d"><use>position</use></value>
<positioned type="bool">true</positioned> <positioned type="bool">true</positioned>
</uniform> </uniform>
<uniform>
<name>Ambient</name>
<type>float-vec4</type>
<value type="vec4d"><use>ambient</use></value>
</uniform>
<uniform> <uniform>
<name>Diffuse</name> <name>Diffuse</name>
<type>float-vec4</type> <type>float-vec4</type>

View file

@ -74,11 +74,6 @@
<value type="vec4d"><use>direction</use></value> <value type="vec4d"><use>direction</use></value>
<positioned type="bool">true</positioned> <positioned type="bool">true</positioned>
</uniform> </uniform>
<uniform>
<name>Ambient</name>
<type>float-vec4</type>
<value type="vec4d"><use>ambient</use></value>
</uniform>
<uniform> <uniform>
<name>Diffuse</name> <name>Diffuse</name>
<type>float-vec4</type> <type>float-vec4</type>

View file

@ -6,7 +6,6 @@ uniform sampler2D normal_tex;
uniform sampler2D color_tex; uniform sampler2D color_tex;
uniform sampler2D spec_emis_tex; uniform sampler2D spec_emis_tex;
uniform vec4 LightPosition; uniform vec4 LightPosition;
uniform vec4 Ambient;
uniform vec4 Diffuse; uniform vec4 Diffuse;
uniform vec4 Specular; uniform vec4 Specular;
uniform vec3 Attenuation; uniform vec3 Attenuation;
@ -47,9 +46,8 @@ void main() {
float nDotHV = max(0.0, dot(normal, halfVector)); float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords ); vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP; vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb; 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);
} }

View file

@ -7,7 +7,6 @@ uniform sampler2D color_tex;
uniform sampler2D spec_emis_tex; uniform sampler2D spec_emis_tex;
uniform vec4 LightPosition; uniform vec4 LightPosition;
uniform vec4 LightDirection; uniform vec4 LightDirection;
uniform vec4 Ambient;
uniform vec4 Diffuse; uniform vec4 Diffuse;
uniform vec4 Specular; uniform vec4 Specular;
uniform vec3 Attenuation; uniform vec3 Attenuation;
@ -59,9 +58,8 @@ void main() {
float nDotHV = max(0.0, dot(normal, halfVector)); float nDotHV = max(0.0, dot(normal, halfVector));
vec4 color = texture2D( color_tex, coords ); vec4 color = texture2D( color_tex, coords );
vec4 Iamb = Ambient * color * att;
vec4 Idiff = Diffuse * color * att * nDotVP; vec4 Idiff = Diffuse * color * att * nDotVP;
vec3 Ispec = pow( nDotHV, spec_emis.y ) * spec_emis.x * att * Specular.rgb; 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);
} }