Improved the specularity by adding a little offset to the energy

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14805 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
samuncle 2013-12-27 02:41:58 +00:00
parent 27e397d2c7
commit cb21815054

View File

@ -26,6 +26,7 @@ void main() {
vec3 light_col = col[i].xyz;
float d = distance(light_pos, xpos.xyz);
float att = energy[i] * 200. / (4. * 3.14 * d * d);
float spec_att = (energy[i] + 10) * 200. / (4. * 3.14 * d * d);
vec3 norm = texture2D(ntex, texc).xyz;
norm = (norm - 0.5) * 2.0;
@ -39,7 +40,7 @@ void main() {
vec3 R = reflect(-L, norm);
float RdotE = max(0.0, dot(R, normalize(xpos.xyz)));
float Specular = pow(RdotE, spec);
specular += Specular * light_col * att;
specular += Specular * light_col * spec_att;
}
gl_FragData[0] = vec4(diffuse, 1.);