fix random white pixels with r_shadow_glossexact caused by unnormalized VectorS/T/R
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Nov 2010 19:18:25 +0000 (19:18 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Nov 2010 19:18:25 +0000 (19:18 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10644 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 356dd37..6156c5c 100644 (file)
@@ -1677,6 +1677,7 @@ static const char *builtinshaderstring =
 "      lightnormal.x = dot(lightnormal_modelspace, myhalf3(VectorS));\n"
 "      lightnormal.y = dot(lightnormal_modelspace, myhalf3(VectorT));\n"
 "      lightnormal.z = dot(lightnormal_modelspace, myhalf3(VectorR));\n"
+"      lightnormal = normalize(lightnormal); // VectorS/T/R are not always perfectly normalized, and EXACTSPECULARMATH is very picky about this\n"
 "      // calculate directional shading (and undoing the existing angle attenuation on the lightmap by the division)\n"
 "      // note that q3map2 is too stupid to calculate proper surface normals when q3map_nonplanar\n"
 "      // is used (the lightmap and deluxemap coords correspond to virtually random coordinates\n"