]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
undo q3map2's directional light attenuation before deluxemapping. Now deluxemapping...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Sep 2008 14:05:01 +0000 (14:05 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Sep 2008 14:05:01 +0000 (14:05 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8516 d7cf8633-e32d-0410-b094-e92efae38249

gl_rmain.c

index 912b1f28c6196b707e0a1cf71212c6436b5f5535..d1ee2700ec908d69961dc85d4749e9c4be1f8b24 100644 (file)
@@ -949,8 +949,8 @@ static const char *builtinshaderstring =
 "      diffusenormal.x = dot(diffusenormal_modelspace, myhalf3(VectorS));\n"
 "      diffusenormal.y = dot(diffusenormal_modelspace, myhalf3(VectorT));\n"
 "      diffusenormal.z = dot(diffusenormal_modelspace, myhalf3(VectorR));\n"
-"      // calculate directional shading\n"
-"      myhalf3 tempcolor = color.rgb * (DiffuseScale * myhalf(max(float(dot(surfacenormal, diffusenormal)), 0.0)));\n"
+"      // calculate directional shading (and undoing the existing angle attenuation on the lightmap by the division)\n"
+"      myhalf3 tempcolor = color.rgb * (DiffuseScale * myhalf(max(float(dot(surfacenormal, diffusenormal) / diffusenormal.z), 0.0)));\n"
 "# ifdef USESPECULAR\n"
 "#  ifdef USEEXACTSPECULARMATH\n"
 "      tempcolor += myhalf3(texture2D(Texture_Gloss, TexCoord)) * SpecularScale * pow(myhalf(max(float(dot(reflect(diffusenormal, surfacenormal), normalize(EyeVector)))*-1.0, 0.0)), SpecularPower);\n"
@@ -972,8 +972,8 @@ static const char *builtinshaderstring =
 "\n"
 "      // get the light normal\n"
 "      myhalf3 diffusenormal = myhalf3(texture2D(Texture_Deluxemap, TexCoordLightmap)) * 2.0 + myhalf3(-1.0, -1.0, -1.0);\n"
-"      // calculate directional shading\n"
-"      myhalf3 tempcolor = color.rgb * (DiffuseScale * myhalf(max(float(dot(surfacenormal, diffusenormal)), 0.0)));\n"
+"      // calculate directional shading (and undoing the existing angle attenuation on the lightmap by the division)\n"
+"      myhalf3 tempcolor = color.rgb * (DiffuseScale * myhalf(max(float(dot(surfacenormal, diffusenormal) / diffusenormal.z), 0.0)));\n"
 "# ifdef USESPECULAR\n"
 "#  ifdef USEEXACTSPECULARMATH\n"
 "      tempcolor += myhalf3(texture2D(Texture_Gloss, TexCoord)) * SpecularScale * pow(myhalf(max(float(dot(reflect(diffusenormal, surfacenormal), normalize(EyeVector)))*-1.0, 0.0)), SpecularPower);\n"