From 8dc267984d9b85a64e40d25ab1cc3ffd531d4d2b Mon Sep 17 00:00:00 2001 From: Mike Daum Date: Fri, 3 Apr 2026 16:15:46 -0400 Subject: [PATCH] Fix HALFRES compositer darkening background behind transparent geometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HALFRES code path in the EffectCompositer hardcodes vec4(0.0, 0.0, 0.0, 1.0) for far-plane pixels (depth == 1.0). The R channel (0.0) is interpreted as full ambient occlusion, which darkens the entire background when transparent objects with depthWrite disabled leave far-plane depth values in the depth buffer. Replace the hardcoded constant with texture2D(tDiffuse, vUv), which bilinearly samples the AO buffer. For background pixels the AO pass already writes 1.0 (no occlusion), so the result is correct while also providing smooth edge transitions at geometry boundaries — avoiding the visible halo that a hard constant produces. --- src/EffectCompositer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EffectCompositer.js b/src/EffectCompositer.js index 3ac8c77..33195fb 100644 --- a/src/EffectCompositer.js +++ b/src/EffectCompositer.js @@ -177,7 +177,7 @@ const EffectCompositer = { #ifdef HALFRES vec4 texel; if (depth == 1.0) { - texel = vec4(0.0, 0.0, 0.0, 1.0); + texel = texture2D(tDiffuse, vUv); } else { vec3 worldPos = getWorldPos(depth, vUv); vec3 normal = computeNormal(getWorldPos(depth, vUv), vUv);