From bc6e0484aba16d925d1df0a6d2115ad415cfe6b7 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 27 May 2023 17:06:55 +1000 Subject: [PATCH] Fixed bug with un-normalised ellipse area lights not having proper area calculation and erroneously reverting to quad lights. --- src/scene/light.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/scene/light.cpp b/src/scene/light.cpp index df0d894d4..2cbbfbca4 100644 --- a/src/scene/light.cpp +++ b/src/scene/light.cpp @@ -1044,11 +1044,11 @@ void LightManager::device_update_lights(Device *device, DeviceScene *dscene, Sce float len_u, len_v; float3 axis_u = normalize_len(extentu, &len_u); float3 axis_v = normalize_len(extentv, &len_v); - float area = len_u * len_v; + float area = light->normalize ? len_u * len_v : 1.0f; if (light->ellipse) { area *= -M_PI_4_F; } - float invarea = (light->normalize && area != 0.0f) ? 1.0f / area : 1.0f; + float invarea = (light->normalize && area != 0.0f) ? 1.0f / area : area; float3 dir = light->dir; /* Clamp angles in (0, 0.1) to 0.1 to prevent zero intensity due to floating-point precision -- 2.30.2