Tweak light attenuation.

Doesnt really change the look of the light but reduce their extent.
This commit is contained in:
Vincent Lejeune 2014-04-27 18:31:00 +02:00
parent 9ac57c3919
commit 18aa119890

View File

@ -32,8 +32,7 @@ void main()
vec3 light_pos = pseudocenter.xyz;
vec3 light_col = col.xyz;
float d = distance(light_pos, xpos.xyz);
float att = energy * 200. / (1 + d + 4. * 3.14 * d * d);
float spec_att = energy * 200. / (1 + d + 4. * 3.14 * d * d);
float att = energy * 200. / (1. + 33. * d + 33. * d * d);
// Light Direction
vec3 L = -normalize(xpos.xyz - light_pos);
@ -41,5 +40,5 @@ void main()
float NdotL = max(0., dot(norm, L));
Diffuse = vec4(NdotL * light_col * att, 1.);
Specular = vec4(getSpecular(norm, eyedir, L, light_col, roughness) * NdotL * spec_att, 1.);
Specular = vec4(getSpecular(norm, eyedir, L, light_col, roughness) * NdotL * att, 1.);
}