From 9529cdfa2e48834153e31803c63ad179c347dc38 Mon Sep 17 00:00:00 2001 From: Perry Fraser Date: Tue, 24 Jun 2025 16:39:18 -0400 Subject: [PATCH] fix: correct wall AO having weird sharp edges (macOS only?) (#38552) --- Content.Client/Light/AmbientOcclusionOverlay.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Content.Client/Light/AmbientOcclusionOverlay.cs b/Content.Client/Light/AmbientOcclusionOverlay.cs index f6b4d0cdfc..f771dbe9fc 100644 --- a/Content.Client/Light/AmbientOcclusionOverlay.cs +++ b/Content.Client/Light/AmbientOcclusionOverlay.cs @@ -24,6 +24,7 @@ public sealed class AmbientOcclusionOverlay : Overlay public override OverlaySpace Space => OverlaySpace.WorldSpaceBelowEntities; private IRenderTexture? _aoTarget; + private IRenderTexture? _aoBlurBuffer; // Couldn't figure out a way to avoid this so if you can then please do. private IRenderTexture? _aoStencilTarget; @@ -70,6 +71,12 @@ public sealed class AmbientOcclusionOverlay : Overlay _aoTarget = _clyde.CreateRenderTarget(target.Size, new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb), name: "ambient-occlusion-target"); } + if (_aoBlurBuffer?.Texture.Size != target.Size) + { + _aoBlurBuffer?.Dispose(); + _aoBlurBuffer = _clyde.CreateRenderTarget(target.Size, new RenderTargetFormatParameters(RenderTargetColorFormat.Rgba8Srgb), name: "ambient-occlusion-blur-target"); + } + if (_aoStencilTarget?.Texture.Size != target.Size) { _aoStencilTarget?.Dispose(); @@ -95,7 +102,7 @@ public sealed class AmbientOcclusionOverlay : Overlay } }, Color.Transparent); - _clyde.BlurRenderTarget(viewport, _aoTarget, _aoTarget, viewport.Eye!, 14f); + _clyde.BlurRenderTarget(viewport, _aoTarget, _aoBlurBuffer, viewport.Eye!, 14f); // Need to do stencilling after blur as it will nuke it. // Draw stencil for the grid so we don't draw in space. -- 2.51.2