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

@ -90,12 +90,12 @@ public static class AtmosphereLutBaker
MieScattering: new Vector3(3.2e-6f, 3.2e-6f, 3.2e-6f), MieScattering: new Vector3(3.2e-6f, 3.2e-6f, 3.2e-6f),
MieG: 0.78f, MieG: 0.78f,
SolarIrradiance: 17.5f, SolarIrradiance: 17.5f,
CalibratedSunEnergy: 1.28f, CalibratedSunEnergy: 2.55f,
FogMaxLengthMeters: 460f, FogMaxLengthMeters: 460f,
VolumetricFogDensity: 0.0008f, VolumetricFogDensity: 0.0008f,
VolumetricFogDetailSpread: 2.4f, VolumetricFogDetailSpread: 2.4f,
VolumetricFogAnisotropy: 0.62f, VolumetricFogAnisotropy: 0.62f,
VolumetricFogEmissionEnergy: 0.18f, VolumetricFogEmissionEnergy: 0f,
ValleyVolumeSize: new Vector3(3100f, 110f, 3100f), ValleyVolumeSize: new Vector3(3100f, 110f, 3100f),
ValleyVolumePosition: new Vector3(0f, 20f, 0f), ValleyVolumePosition: new Vector3(0f, 20f, 0f),
ValleyVolumeDensity: 0.0038f, ValleyVolumeDensity: 0.0038f,
@ -108,7 +108,7 @@ public static class AtmosphereLutBaker
DepthFogAerialPerspective: 0.88f, DepthFogAerialPerspective: 0.88f,
DepthFogSunScatter: 0.45f, DepthFogSunScatter: 0.45f,
ShadowMaxDistance: 320f, ShadowMaxDistance: 320f,
AmbientLightEnergy: 0.48f, AmbientLightEnergy: 0.0f,
SunDiscIntensity: 8.5f, SunDiscIntensity: 8.5f,
MieAureoleStrength: 0.24f) MieAureoleStrength: 0.24f)
: new AtmospherePreset( : new AtmospherePreset(
@ -120,12 +120,12 @@ public static class AtmosphereLutBaker
MieScattering: new Vector3(10.5e-6f, 8.8e-6f, 6.6e-6f), MieScattering: new Vector3(10.5e-6f, 8.8e-6f, 6.6e-6f),
MieG: 0.74f, MieG: 0.74f,
SolarIrradiance: 16.0f, SolarIrradiance: 16.0f,
CalibratedSunEnergy: 1.42f, CalibratedSunEnergy: 2.05f,
FogMaxLengthMeters: 380f, FogMaxLengthMeters: 380f,
VolumetricFogDensity: 0.0012f, VolumetricFogDensity: 0.0012f,
VolumetricFogDetailSpread: 2.2f, VolumetricFogDetailSpread: 2.2f,
VolumetricFogAnisotropy: 0.68f, VolumetricFogAnisotropy: 0.68f,
VolumetricFogEmissionEnergy: 0.22f, VolumetricFogEmissionEnergy: 0f,
ValleyVolumeSize: new Vector3(1600f, 56f, 1600f), ValleyVolumeSize: new Vector3(1600f, 56f, 1600f),
ValleyVolumePosition: new Vector3(0f, 2f, 0f), ValleyVolumePosition: new Vector3(0f, 2f, 0f),
ValleyVolumeDensity: 0.0052f, ValleyVolumeDensity: 0.0052f,
@ -138,7 +138,7 @@ public static class AtmosphereLutBaker
DepthFogAerialPerspective: 0.22f, DepthFogAerialPerspective: 0.22f,
DepthFogSunScatter: 0.65f, DepthFogSunScatter: 0.65f,
ShadowMaxDistance: 280f, ShadowMaxDistance: 280f,
AmbientLightEnergy: 0.55f, AmbientLightEnergy: 0.0f,
SunDiscIntensity: 8.0f, SunDiscIntensity: 8.0f,
MieAureoleStrength: 0.30f); MieAureoleStrength: 0.30f);

View file

@ -16,6 +16,8 @@ public partial class AtmosphereSystem : Node
private Sky _sky = null!; private Sky _sky = null!;
private ShaderMaterial _skyMat = null!; private ShaderMaterial _skyMat = null!;
private DirectionalLight3D _sun = null!; private DirectionalLight3D _sun = null!;
private DirectionalLight3D _skyFill = null!;
private DirectionalLight3D _groundBounce = null!;
private FogVolume _valleyFog = null!; private FogVolume _valleyFog = null!;
private FogMaterial _valleyFogMat = null!; private FogMaterial _valleyFogMat = null!;
private CanvasLayer _filmGrainLayer = null!; private CanvasLayer _filmGrainLayer = null!;
@ -65,13 +67,14 @@ public partial class AtmosphereSystem : Node
{ {
BackgroundMode = Godot.Environment.BGMode.Sky, BackgroundMode = Godot.Environment.BGMode.Sky,
Sky = _sky, Sky = _sky,
AmbientLightSource = Godot.Environment.AmbientSource.Sky, AmbientLightSource = Godot.Environment.AmbientSource.Disabled,
AmbientLightEnergy = 0.48f, AmbientLightEnergy = 0.0f,
SdfgiEnabled = false,
// AgX tonemapping preserves orange/amber combat hues while rolling off HDR emitters smoothly // AgX tonemapping preserves orange/amber combat hues while rolling off HDR emitters smoothly
TonemapMode = Godot.Environment.ToneMapper.Agx, TonemapMode = Godot.Environment.ToneMapper.Agx,
TonemapAgxWhite = 6.0f, TonemapAgxWhite = 6.0f,
TonemapAgxContrast = 1.22f, TonemapAgxContrast = 1.35f,
TonemapExposure = 1.0f, TonemapExposure = 1.0f,
// Normalized additive bloom strictly above GlowHdrThreshold=1.0 (zero diffuse screen smear) // 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 // Screen-space ambient occlusion for mech foot & building contact grounding
SsaoEnabled = true, SsaoEnabled = true,
SsaoRadius = 1.15f, SsaoRadius = 1.15f,
SsaoIntensity = 1.85f, SsaoIntensity = 2.2f,
SsaoPower = 1.5f, SsaoPower = 1.5f,
SsaoDetail = 0.45f, SsaoDetail = 0.45f,
SsaoHorizon = 0.06f, SsaoHorizon = 0.06f,
SsaoSharpness = 0.98f, SsaoSharpness = 0.98f,
SsaoLightAffect = 0.12f, SsaoLightAffect = 0.24f,
SsaoAOChannelAffect = 0.5f, SsaoAOChannelAffect = 0.5f,
// Tier 1: Froxel volumetric fog (0..380/460m) // Tier 1: Froxel volumetric fog (0..380/460m)
VolumetricFogEnabled = true, VolumetricFogEnabled = true,
VolumetricFogTemporalReprojectionEnabled = true, VolumetricFogTemporalReprojectionEnabled = true,
VolumetricFogTemporalReprojectionAmount = 0.88f, VolumetricFogTemporalReprojectionAmount = 0.88f,
VolumetricFogAmbientInject = 0.25f, VolumetricFogAmbientInject = 0.0f,
VolumetricFogSkyAffect = 0.10f, VolumetricFogSkyAffect = 0.10f,
// Tier 2: Far aerial perspective (340/400m .. horizon peaks) // Tier 2: Far aerial perspective (340/400m .. horizon peaks)
@ -178,6 +181,24 @@ public partial class AtmosphereSystem : Node
}; };
AddChild(_sun); 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 _valleyFogMat = new FogMaterial
{ {
Density = 0.0038f, Density = 0.0038f,
@ -242,6 +263,20 @@ public partial class AtmosphereSystem : Node
_sun.LightEnergy = baked.SunLightEnergy; _sun.LightEnergy = baked.SunLightEnergy;
_sun.DirectionalShadowMaxDistance = preset.ShadowMaxDistance; _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; _env.AmbientLightEnergy = preset.AmbientLightEnergy;
Color haze = baked.HazeColor; Color haze = baked.HazeColor;
@ -249,9 +284,9 @@ public partial class AtmosphereSystem : Node
_env.VolumetricFogDensity = preset.VolumetricFogDensity; _env.VolumetricFogDensity = preset.VolumetricFogDensity;
_env.VolumetricFogDetailSpread = preset.VolumetricFogDetailSpread; _env.VolumetricFogDetailSpread = preset.VolumetricFogDetailSpread;
_env.VolumetricFogAnisotropy = preset.VolumetricFogAnisotropy; _env.VolumetricFogAnisotropy = preset.VolumetricFogAnisotropy;
_env.VolumetricFogEmissionEnergy = preset.VolumetricFogEmissionEnergy; _env.VolumetricFogEmissionEnergy = 0f;
_env.VolumetricFogAlbedo = haze; _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.Size = preset.ValleyVolumeSize;
_valleyFog.Position = preset.ValleyVolumePosition; _valleyFog.Position = preset.ValleyVolumePosition;
@ -259,7 +294,7 @@ public partial class AtmosphereSystem : Node
_valleyFogMat.HeightFalloff = preset.ValleyVolumeHeightFalloff; _valleyFogMat.HeightFalloff = preset.ValleyVolumeHeightFalloff;
_valleyFogMat.EdgeFade = preset.ValleyVolumeEdgeFade; _valleyFogMat.EdgeFade = preset.ValleyVolumeEdgeFade;
_valleyFogMat.Albedo = haze; _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.FogLightColor = haze;
_env.FogDepthBegin = preset.DepthFogBegin; _env.FogDepthBegin = preset.DepthFogBegin;

View file

@ -486,11 +486,12 @@ void main() {
// Dense interiors stay deep velvety charcoal soot; rimBoost (1.65) applies strictly to thin outer sunlit vapor edges // Dense interiors stay deep velvety charcoal soot; rimBoost (1.65) applies strictly to thin outer sunlit vapor edges
float sootContour = 1.0 / (1.0 + 4.6 * rawDens); float sootContour = 1.0 / (1.0 + 4.6 * rawDens);
float sunAlignment = clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0); float sunAlignment = clamp(dot(localUpOrRadial, sunDir), -1.0, 1.0);
float rimBias = 0.36 + 0.64 * max(0.0, sunAlignment) + 0.14 * (0.5 + 0.5 * sunAlignment); float rimBias = max(0.0, sunAlignment);
float rimFactor = 1.0 + 0.65 * smoothstep(0.25, 0.72, sootContour); float rimFactor = 1.0 + 0.65 * smoothstep(0.25, 0.72, sootContour);
vec3 sunlitEdgeTint = mix(albedo, albedo * 1.35 + vec3(0.045, 0.040, 0.036), sootContour * smoothstep(0.10, 0.78, max(0.0, sunAlignment) + phase)); vec3 sunlitEdgeTint = mix(albedo, albedo * 1.35 + vec3(0.045, 0.040, 0.036), sootContour * smoothstep(0.10, 0.78, max(0.0, sunAlignment) + phase));
float vaporEdgeFade = smoothstep(0.0, 0.08, rawDens); float vaporEdgeFade = smoothstep(0.0, 0.08, rawDens);
vec3 scatterLum = sunlitEdgeTint * (sootContour * vaporEdgeFade * rimFactor) * (sunRad * (rimBias + phase * 2.6) + ambRad * 0.25); vec3 skyBounce = max(0.0, localUpOrRadial.y) * 0.08 * ambRad;
vec3 scatterLum = sunlitEdgeTint * (sootContour * vaporEdgeFade * rimFactor) * (sunRad * (rimBias + phase * 2.6) + skyBounce);
// Layer 3: Sharp turbulent core-only combustion peeking through dark soot crevices // Layer 3: Sharp turbulent core-only combustion peeking through dark soot crevices
vec3 plasmaEmit = vec3(0.0); vec3 plasmaEmit = vec3(0.0);