]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
more work on mod_generatelightmaps:
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 27 Nov 2009 15:31:58 +0000 (15:31 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 27 Nov 2009 15:31:58 +0000 (15:31 +0000)
don't accept lights behind a surface, they mess up shading

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9524 d7cf8633-e32d-0410-b094-e92efae38249

model_shared.c

index 1635e0877ecf123bda39c0e8aa66def1daaafd8a..faec4c5aa1c284055da9d072ad040e6a406d98b7 100644 (file)
@@ -3219,6 +3219,9 @@ static void Mod_GenerateLightmaps_SamplePoint(const float *pos, const float *nor
        {
                //R_SampleRTLights(pos, sample, numoffsets, offsets);
                VectorSubtract(lightinfo->origin, pos, relativepoint);
+               // don't accept light from behind a surface, it causes bad shading
+               if (normal && DotProduct(relativepoint, normal) <= 0)
+                       continue;
                dist2 = VectorLength2(relativepoint);
                if (dist2 >= lightinfo->radius2)
                        continue;