Lighting: directional sun shadows from the day/night sun angle
DayNight.SunShadow returns a cell offset opposite the sun's east-west position, longest near sunrise/sunset (low sun) and zero at noon/night, tilted slightly south so shadows fall in front of occluders. LightmapBuilder gains a directional shadow pass (MaxShadowCells length cap, SunShadowStrength darkening); LightmapSystem feeds it the current sun shadow each rebuild. Tests cover SunShadow's day-arc behaviour and the builder's directional darkening.
This commit is contained in:
@@ -15,6 +15,8 @@ public sealed class LightmapSystem : BaseSystem
|
||||
{
|
||||
private const int RebuildEvery = 6; // ~10 Гц при 60 fps
|
||||
private const float NightFloor = 0.18f; // ночь тусклая, но не чёрная (лунный свет)
|
||||
private const float MaxShadowCells = 7f; // макс. длина тени от солнца (на рассвете/закате)
|
||||
private const float SunShadowStrength = 0.5f; // насколько темнеет клетка у основания тени
|
||||
|
||||
private readonly Lightmap _lightmap;
|
||||
private readonly DayNight _dayNight;
|
||||
@@ -77,7 +79,9 @@ public sealed class LightmapSystem : BaseSystem
|
||||
_lightmap.Height,
|
||||
ambient,
|
||||
_occluders(),
|
||||
_lights
|
||||
_lights,
|
||||
_dayNight.SunShadow(MaxShadowCells),
|
||||
SunShadowStrength
|
||||
);
|
||||
_lightmap.Upload();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user