Allow length of the light direction vector to influence strength of the light source.
This fixes the issue with objects and terrain being darker than they should be. As it turns out, most levels have not normalized light direction which happens to make light brighter and this is the expected result. To keep in line with GL14 engine, newer engines should use the length of the vector to make light brighter.pyro-refactor
parent
aa8122f16f
commit
33b7c893cb
|
@ -84,8 +84,8 @@ void main()
|
|||
{
|
||||
LightParams light = uni_Light[i];
|
||||
|
||||
vec3 lightDirection = normalize(light.Position.xyz);
|
||||
vec3 reflectAxis = normalize(lightDirection + camera);
|
||||
vec3 lightDirection = light.Position.xyz;
|
||||
vec3 reflectAxis = normalize(normalize(lightDirection) + camera);
|
||||
|
||||
float diffuseComponent = clamp(dot(normal, lightDirection), 0.0f, 1.0f);
|
||||
float specularComponent = pow(clamp(dot(normal, reflectAxis), 0.0f, 1.0f), 10.0f);
|
||||
|
|
|
@ -83,8 +83,8 @@ void main()
|
|||
|
||||
for (int i = 0; i < uni_LightCount; i++)
|
||||
{
|
||||
vec3 lightDirection = normalize(uni_Light[i].Position.xyz);
|
||||
vec3 reflectAxis = normalize(lightDirection + camera);
|
||||
vec3 lightDirection = uni_Light[i].Position.xyz;
|
||||
vec3 reflectAxis = normalize(normalize(lightDirection) + camera);
|
||||
|
||||
ambient += uni_Light[i].Ambient;
|
||||
diffuse += clamp(dot(normal, lightDirection), 0.0f, 1.0f)
|
||||
|
|
Loading…
Reference in New Issue