From 820a92ddc1a6419611f3b01f8cfa2adfd55220df Mon Sep 17 00:00:00 2001 From: Anders Pistol Date: Thu, 22 Feb 2024 21:41:47 +0100 Subject: [PATCH] Traktor: More tolerance fixes in HiZ culling. --- data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi | 10 +++++----- .../System/World/Overlay/Shaders/OverlayTargets.xdi | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi b/data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi index 991ba31e60..0a5a4c5b11 100644 --- a/data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi +++ b/data/Source/System/Mesh/Shaders/Instance/Cull/Cull.xdi @@ -272,7 +272,7 @@ $Buffer[index].visible = $Input; 721 - 756 + 755 HiZ @@ -342,14 +342,14 @@ const float P11 = $Projection[1][1]; vec4 aabb; if (ProjectSphere(viewCenter.xyz, radius, znear, P00, P11, aabb)) { - const vec2 hs = textureSize($HiZTexture, 0); - const ivec2 osz = ivec2($TargetSize.xy) / 2; + const vec2 osz = vec2($TargetSize.xy) / 2.0f; const float width = (aabb.z - aabb.x) * osz.x; const float height = (aabb.w - aabb.y) * osz.y; - const float level = floor(log2(max(width, height))); + const float level = ceil(log2(max(width, height))); - const vec2 s = vec2(osz) / hs; + const vec2 hs = textureSize($HiZTexture, 0); + const vec2 s = osz / hs; const vec2 p = ((aabb.xy + aabb.zw) * 0.5f) * s; const float depth = textureLod(sampler2D($HiZTexture, $HiZState), p, level).x; diff --git a/data/Source/System/World/Overlay/Shaders/OverlayTargets.xdi b/data/Source/System/World/Overlay/Shaders/OverlayTargets.xdi index 8f3b299ef2..5428ba0928 100644 --- a/data/Source/System/World/Overlay/Shaders/OverlayTargets.xdi +++ b/data/Source/System/World/Overlay/Shaders/OverlayTargets.xdi @@ -2285,7 +2285,7 @@ else -820 4072 - 2 + 6 {431F1C47-067D-5042-B5DC-20EBDF01A8C7} @@ -2329,9 +2329,9 @@ else