From 860080ada3936f12feb01043032278db0fef3e57 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Tue, 24 Sep 2024 16:16:50 +0100 Subject: [PATCH] Add HDR lightmap support --- KeepersCompound.Lightmapper/Program.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/KeepersCompound.Lightmapper/Program.cs b/KeepersCompound.Lightmapper/Program.cs index b8c8164..14978e8 100644 --- a/KeepersCompound.Lightmapper/Program.cs +++ b/KeepersCompound.Lightmapper/Program.cs @@ -213,6 +213,8 @@ class Program private static void CastScene(Raytracer scene, WorldRep wr, Light[] lights, Vector3 ambientLight) { + var hdr = wr.DataHeader.LightmapFormat == 2; + var cells = wr.Cells; for (var cellIdx = 0; cellIdx < cells.Length; cellIdx++) { @@ -318,6 +320,10 @@ class Program var len = dir.Length(); var slen = len / 4.0f; var strength = (angle + 1.0f) / slen; + if (hdr) + { + strength /= 2; + } strength = Math.Min(1.0f, strength); var c = light.color * strength;