From 06803fa07f4ed05b31e9ca1b602dbf711c35fe67 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 10 Dec 2024 16:55:22 +0000 Subject: [PATCH] Add light max effective radius method --- KeepersCompound.Lightmapper/Light.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/KeepersCompound.Lightmapper/Light.cs b/KeepersCompound.Lightmapper/Light.cs index f7991e6..cb7523a 100644 --- a/KeepersCompound.Lightmapper/Light.cs +++ b/KeepersCompound.Lightmapper/Light.cs @@ -7,6 +7,7 @@ public class Light { public Vector3 Position; public Vector3 Color; + public float Brightness; public float InnerRadius; public float Radius; public float R2; @@ -81,4 +82,15 @@ public class Light return strength; } + + public float CalculateMaxRadius(float minLightCutoff) + { + // TODO: Should it be ceiling'd? Do we need to care about hdr? (I don't think so) + var radius = 8 * Brightness / minLightCutoff; + return radius; + + // 2 / (x / 4.0f) = minLightCutoff; + // 2 / minLightCutOff = x / 4.0f; + // x = 8 * rgb / minLightCutOff; + } } \ No newline at end of file