From 88649934634b056091db4d4618ca97c778c5e39b Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Sun, 23 Feb 2025 19:40:21 +0000 Subject: [PATCH] Fix light vis not including light's cell in fast mode --- KeepersCompound.Lightmapper/LightMapper.cs | 4 ++-- KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KeepersCompound.Lightmapper/LightMapper.cs b/KeepersCompound.Lightmapper/LightMapper.cs index ddcaf92..ac66f55 100644 --- a/KeepersCompound.Lightmapper/LightMapper.cs +++ b/KeepersCompound.Lightmapper/LightMapper.cs @@ -564,8 +564,8 @@ public class LightMapper } var visibleSet = settings.FastPvs switch { - true => pvs.ComputeVisibilityFast(lightCellMap[i]), - false => pvs.ComputeVisibilityExact(_lights[i].Position, lightCellMap[i], _lights[i].Radius) + true => pvs.ComputeVisibilityFast(cellIdx), + false => pvs.ComputeVisibilityExact(_lights[i].Position, cellIdx, _lights[i].Radius) }; // Log.Information("Light {i} sees {c} cells", i, visibleSet.Count); diff --git a/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs b/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs index e436886..74e6c5f 100644 --- a/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs +++ b/KeepersCompound.Lightmapper/PotentiallyVisibleSet.cs @@ -154,7 +154,7 @@ public class PotentiallyVisibleSet return []; } - var visibleCells = new HashSet(); + var visibleCells = new HashSet { cellIdx }; foreach (var edgeIdx in _graph[cellIdx].EdgeIndices) { var edge = _edges[edgeIdx];