diff --git a/client/AtmosphereSystem.cs b/client/AtmosphereSystem.cs index 60905b3..8007ed9 100644 --- a/client/AtmosphereSystem.cs +++ b/client/AtmosphereSystem.cs @@ -71,9 +71,11 @@ public partial class AtmosphereSystem : Node // Option 1 (Low-Gamma): SDFGI multi-bounce + occlusion with zero flat ambient SdfgiEnabled = true, SdfgiUseOcclusion = true, + SdfgiReadSkyLight = true, SdfgiBounceFeedback = 0.60f, - SdfgiCascades = 4, - SdfgiMinCellSize = 0.4f, + SdfgiCascades = 3, + SdfgiMinCellSize = 0.8f, + SdfgiYScale = Godot.Environment.SdfgiyScale.Scale75Percent, SdfgiEnergy = 0.85f, // AgX tonemapping preserves orange/amber combat hues while rolling off HDR emitters smoothly @@ -147,6 +149,10 @@ public partial class AtmosphereSystem : Node if (RenderingServer.GetRenderingDevice() is not null) { + RenderingServer.GISetUseHalfResolution(true); + RenderingServer.EnvironmentSetSdfgiRayCount(RenderingServer.EnvironmentSdfgiRayCount.Count4); + RenderingServer.EnvironmentSetSdfgiFramesToConverge(RenderingServer.EnvironmentSdfgiFramesToConverge.In10Frames); + RenderingServer.EnvironmentSetSdfgiFramesToUpdateLight(RenderingServer.EnvironmentSdfgiFramesToUpdateLight.In8Frames); _flowTexRd = new Texture3Drd(); RegisterGlobalParamIfMissing("rtd_flow_field", RenderingServer.GlobalShaderParameterType.Sampler3D, _flowTexRd); _volumetricEffect = new VolumetricCompositorEffect(_flowTexRd, _emitterPool); diff --git a/client/Main.cs b/client/Main.cs index bb1432f..2e1c271 100644 --- a/client/Main.cs +++ b/client/Main.cs @@ -103,6 +103,7 @@ public partial class Main : Node3D private readonly List _perfNodeCount = new(); private readonly List _perfTimeProcess = new(); private readonly List _perfTimePhysicsProcess = new(); + private readonly List _perfViewportGpuMs = new(); private double _perfPendingStepMs; private double _perfPendingTerrainMs; private double _perfPendingArenaMs; @@ -1415,6 +1416,10 @@ public partial class Main : Node3D _perfNodeCount.Add(Performance.GetMonitor(Performance.Monitor.ObjectNodeCount)); _perfTimeProcess.Add(Performance.GetMonitor(Performance.Monitor.TimeProcess) * 1000.0); _perfTimePhysicsProcess.Add(Performance.GetMonitor(Performance.Monitor.TimePhysicsProcess) * 1000.0); + if (ArenaSession.PerfEnabled) + { + _perfViewportGpuMs.Add(RenderingServer.ViewportGetMeasuredRenderTimeGpu(GetViewport().GetViewportRid())); + } _perfFrameCount++; if (_perfFrameCount >= _perfTargetFrames) @@ -1570,7 +1575,7 @@ public partial class Main : Node3D double steadyFps = steadyAvgMs > 0 ? 1000.0 / steadyAvgMs : 0; GD.Print("=== PERF BENCHMARK SUMMARY ==="); - GD.Print($"Frames={_perfFrameMs.Count} PhysicsTicks={_perfPhysicsTicks} AvgFPS={fps:F2} SteadyFPS(10..59)={steadyFps:F2} EngineFPS={Engine.GetFramesPerSecond():F1}"); + GD.Print($"Frames={_perfFrameMs.Count} PhysicsTicks={_perfPhysicsTicks} AvgFPS={fps:F2} SteadyFPS(10..{_perfFrameMs.Count - 1})={steadyFps:F2} EngineFPS={Engine.GetFramesPerSecond():F1}"); GD.Print($"frameMs: avg={Avg(_perfFrameMs):F2} steadyAvg={steadyAvgMs:F2} p95={P95(_perfFrameMs):F2}"); GD.Print($"physicsStepMs/frame: avg={Avg(_perfPhysicsStepMs):F2} p95={P95(_perfPhysicsStepMs):F2}"); GD.Print($"terrainSyncMs/frame: avg={Avg(_perfTerrainSyncMs):F2} p95={P95(_perfTerrainSyncMs):F2} dirtyRebakesTotal={rebakeTotal} dirtyRebakesAvg={rebakeAvg:F2}"); @@ -1592,6 +1597,16 @@ public partial class Main : Node3D double vpGpuMs = RenderingServer.ViewportGetMeasuredRenderTimeGpu(vpRid); double vpCpuMs = RenderingServer.ViewportGetMeasuredRenderTimeCpu(vpRid); GD.Print($"Cut10bGpuMs: total={volFx.LastTotalGpuMs:F3} flow={volFx.LastFlowGpuMs:F3} cull={volFx.LastCullGpuMs:F3} march={volFx.LastMarchGpuMs:F3} comp={volFx.LastCompGpuMs:F3} viewportGpuMs={vpGpuMs:F2} viewportCpuMs={vpCpuMs:F2}"); + if (_perfViewportGpuMs.Count > 10) + { + var steadyGpu = new List(_perfViewportGpuMs.Count - 10); + for (int i = 10; i < _perfViewportGpuMs.Count; i++) steadyGpu.Add(_perfViewportGpuMs[i]); + steadyGpu.Sort(); + double gpuP50 = steadyGpu[(int)Math.Clamp(Math.Floor(steadyGpu.Count * 0.50), 0, steadyGpu.Count - 1)]; + double gpuP95 = steadyGpu[(int)Math.Clamp(Math.Ceiling(steadyGpu.Count * 0.95) - 1, 0, steadyGpu.Count - 1)]; + double gpuMax = steadyGpu[^1]; + GD.Print($"viewportGpuMsTimeline(10..{_perfViewportGpuMs.Count - 1}): avg={Avg(steadyGpu):F2} p50={gpuP50:F2} p95={gpuP95:F2} max={gpuMax:F2}"); + } } if (_session is not null) {