" diffusenormal.y = dot(diffusenormal_modelspace, myhalf3(VectorT));\n"
" diffusenormal.z = dot(diffusenormal_modelspace, myhalf3(VectorR));\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"
+" // 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"
+" // on that luxel, and NOT to its center, because recursive triangle subdivision is used\n"
+" // to map the luxels to coordinates on the draw surfaces), which also causes\n"
+" // deluxemaps to be wrong because light contributions from the wrong side of the surface\n"
+" // are added up. To prevent divisions by zero or strong exaggerations, a max()\n"
+" // nudge is done here at expense of some additional fps. This is ONLY needed for\n"
+" // deluxemaps, tangentspace deluxemap avoid this problem by design.\n"
+" myhalf3 tempcolor = color.rgb * (DiffuseScale * myhalf(max(float(dot(surfacenormal, diffusenormal) / max(0.25, diffusenormal.z)), 0.0)));\n"
+" // 0.25 supports up to 75.5 degrees normal/deluxe angle\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"