From: divverent Date: Tue, 30 Sep 2008 14:05:01 +0000 (+0000) Subject: undo q3map2's directional light attenuation before deluxemapping. Now deluxemapping... X-Git-Tag: xonotic-v0.1.0preview~2072 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=83846e180d5ba65b89c13a4051415e3b3b02ea73;p=xonotic%2Fdarkplaces.git undo q3map2's directional light attenuation before deluxemapping. Now deluxemapping and non-deluxemapping have the same perceived brightness. May reduce fps in deluxemapping mode. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8516 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/gl_rmain.c b/gl_rmain.c index 912b1f28..d1ee2700 100644 --- a/gl_rmain.c +++ b/gl_rmain.c @@ -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"