From 11304cf0591d0dde620a3fe24f053d9102eef55d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 4 Nov 2016 01:26:48 -0600 Subject: [PATCH] light: hack around invalid normals in bounce lighting patches.. needs further investigation --- light/ltface.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/light/ltface.cc b/light/ltface.cc index 7c512a2c..78f7bb7a 100644 --- a/light/ltface.cc +++ b/light/ltface.cc @@ -1260,7 +1260,12 @@ ProjectPointOntoPlane(const vec3_t point, const plane_t *plane, vec3_t out) void GetDirectLighting(const globalconfig_t &cfg, raystream_t *rs, const vec3_t origin, const vec3_t normal, vec3_t colorout) { - const float occlusion = DirtAtPoint(cfg, rs, origin, normal, /* FIXME: pass selfshadow? */ nullptr); + float occlusion = DirtAtPoint(cfg, rs, origin, normal, /* FIXME: pass selfshadow? */ nullptr); + if (isnan(occlusion)) { + // HACK: getting an invalid normal of (0, 0, 0). + occlusion = 0.0f; + } + VectorSet(colorout, 0, 0, 0); for (const light_t &entity : GetLights()) {