Fix shadow acne on super shallow lighting angles

This commit is contained in:
Jarrod Doyle 2025-01-26 12:55:20 +00:00
parent c28626bf20
commit cae43f12ad
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
1 changed files with 2 additions and 1 deletions

View File

@ -832,7 +832,7 @@ public class LightMapper
for (var i = 0; i < offsets.Length; i++)
{
var offset = offsets[i];
var pos = basePosition + offset;
var pos = basePosition + offset + planeMapper.Normal * MathUtils.Epsilon;
// If the target lightmap point is in view of the center
// then we can use it as-is. Using it straight fixes seams and such.
@ -852,6 +852,7 @@ public class LightMapper
var p2d = planeMapper.MapTo2d(pos);
p2d = MathUtils.ClipPointToPoly2d(p2d, v2ds);
pos = planeMapper.MapTo3d(p2d);
pos += planeMapper.Normal * MathUtils.Epsilon;
// If the clipping fails, just say screw it and cast :(
if (TraceOcclusion(_sceneNoObj, polyCenter, pos))