From 7b6f7fdf7194eb66fe973b473ab385e035984070 Mon Sep 17 00:00:00 2001 From: havoc Date: Fri, 27 Nov 2009 15:31:58 +0000 Subject: [PATCH] more work on mod_generatelightmaps: 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/model_shared.c b/model_shared.c index 1635e087..faec4c5a 100644 --- a/model_shared.c +++ b/model_shared.c @@ -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; -- 2.39.2