Lighting probe: zero ambient, zero fog emission, directional sky/ground bounce

This commit is contained in:
Meta Vens 2026-12-05 22:54:18 +01:00
commit df07e44366
3 changed files with 53 additions and 17 deletions

View file

@ -16,6 +16,8 @@ public partial class AtmosphereSystem : Node
private Sky _sky = null!;
private ShaderMaterial _skyMat = null!;
private DirectionalLight3D _sun = null!;
private DirectionalLight3D _skyFill = null!;
private DirectionalLight3D _groundBounce = null!;
private FogVolume _valleyFog = null!;
private FogMaterial _valleyFogMat = null!;
private CanvasLayer _filmGrainLayer = null!;
@ -65,13 +67,14 @@ public partial class AtmosphereSystem : Node
{
BackgroundMode = Godot.Environment.BGMode.Sky,
Sky = _sky,
AmbientLightSource = Godot.Environment.AmbientSource.Sky,
AmbientLightEnergy = 0.48f,
AmbientLightSource = Godot.Environment.AmbientSource.Disabled,
AmbientLightEnergy = 0.0f,
SdfgiEnabled = false,
// AgX tonemapping preserves orange/amber combat hues while rolling off HDR emitters smoothly
TonemapMode = Godot.Environment.ToneMapper.Agx,
TonemapAgxWhite = 6.0f,
TonemapAgxContrast = 1.22f,
TonemapAgxContrast = 1.35f,
TonemapExposure = 1.0f,
// Normalized additive bloom strictly above GlowHdrThreshold=1.0 (zero diffuse screen smear)
@ -95,19 +98,19 @@ public partial class AtmosphereSystem : Node
// Screen-space ambient occlusion for mech foot & building contact grounding
SsaoEnabled = true,
SsaoRadius = 1.15f,
SsaoIntensity = 1.85f,
SsaoIntensity = 2.2f,
SsaoPower = 1.5f,
SsaoDetail = 0.45f,
SsaoHorizon = 0.06f,
SsaoSharpness = 0.98f,
SsaoLightAffect = 0.12f,
SsaoLightAffect = 0.24f,
SsaoAOChannelAffect = 0.5f,
// Tier 1: Froxel volumetric fog (0..380/460m)
VolumetricFogEnabled = true,
VolumetricFogTemporalReprojectionEnabled = true,
VolumetricFogTemporalReprojectionAmount = 0.88f,
VolumetricFogAmbientInject = 0.25f,
VolumetricFogAmbientInject = 0.0f,
VolumetricFogSkyAffect = 0.10f,
// Tier 2: Far aerial perspective (340/400m .. horizon peaks)
@ -178,6 +181,24 @@ public partial class AtmosphereSystem : Node
};
AddChild(_sun);
_skyFill = new DirectionalLight3D
{
Name = "SkyHemisphereFill",
ShadowEnabled = false,
LightVolumetricFogEnergy = 0.0f,
LightAngularDistance = 0.0f
};
AddChild(_skyFill);
_groundBounce = new DirectionalLight3D
{
Name = "GroundBounceFill",
ShadowEnabled = false,
LightVolumetricFogEnergy = 0.0f,
LightAngularDistance = 0.0f
};
AddChild(_groundBounce);
_valleyFogMat = new FogMaterial
{
Density = 0.0038f,
@ -242,6 +263,20 @@ public partial class AtmosphereSystem : Node
_sun.LightEnergy = baked.SunLightEnergy;
_sun.DirectionalShadowMaxDistance = preset.ShadowMaxDistance;
// Option 2: Shadowless directional sky-hemisphere + ground-bounce fill (zero flat ambient, zero SDFGI cost)
bool isSion = mapKind == ArenaMapKind.Sion;
_skyFill.RotationDegrees = new Vector3(-68f, preset.SunYawDeg + 180f, 0f);
_skyFill.LightColor = isSion
? new Color(0.56f, 0.72f, 0.98f)
: new Color(0.60f, 0.74f, 0.96f);
_skyFill.LightEnergy = isSion ? 0.14f : 0.07f;
_groundBounce.RotationDegrees = new Vector3(82f, preset.SunYawDeg, 0f);
_groundBounce.LightColor = isSion
? new Color(0.86f, 0.80f, 0.68f)
: new Color(0.92f, 0.70f, 0.44f);
_groundBounce.LightEnergy = isSion ? 0.08f : 0.05f;
_env.AmbientLightEnergy = preset.AmbientLightEnergy;
Color haze = baked.HazeColor;
@ -249,9 +284,9 @@ public partial class AtmosphereSystem : Node
_env.VolumetricFogDensity = preset.VolumetricFogDensity;
_env.VolumetricFogDetailSpread = preset.VolumetricFogDetailSpread;
_env.VolumetricFogAnisotropy = preset.VolumetricFogAnisotropy;
_env.VolumetricFogEmissionEnergy = preset.VolumetricFogEmissionEnergy;
_env.VolumetricFogEmissionEnergy = 0f;
_env.VolumetricFogAlbedo = haze;
_env.VolumetricFogEmission = new Color(haze.R * 0.45f, haze.G * 0.45f, haze.B * 0.45f, 1.0f);
_env.VolumetricFogEmission = Colors.Black;
_valleyFog.Size = preset.ValleyVolumeSize;
_valleyFog.Position = preset.ValleyVolumePosition;
@ -259,7 +294,7 @@ public partial class AtmosphereSystem : Node
_valleyFogMat.HeightFalloff = preset.ValleyVolumeHeightFalloff;
_valleyFogMat.EdgeFade = preset.ValleyVolumeEdgeFade;
_valleyFogMat.Albedo = haze;
_valleyFogMat.Emission = new Color(haze.R * 0.35f, haze.G * 0.35f, haze.B * 0.35f, 1.0f);
_valleyFogMat.Emission = Colors.Black;
_env.FogLightColor = haze;
_env.FogDepthBegin = preset.DepthFogBegin;