From 610e93fc7e488361d781723d0a6a6a4359631256 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Feb 2026 04:44:05 +0000 Subject: [PATCH] fix: set GTAO thickness parameter and restore MRT normals Added thickness = 0.5 to GTAO to help with depth discontinuity artifacts on InstancedMesh. Higher thickness provides more tolerance for depth differences, reducing edge artifacts. Restored MRT normal pass (reverted diagnostic null test). https://claude.ai/code/session_012kqvccEiiHNQHAjUEoposi --- src/rendering/tsl/PostProcessing.ts | 6 ++---- src/rendering/tsl/effects/EffectPasses.ts | 5 +++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rendering/tsl/PostProcessing.ts b/src/rendering/tsl/PostProcessing.ts index a8de6474..34736617 100644 --- a/src/rendering/tsl/PostProcessing.ts +++ b/src/rendering/tsl/PostProcessing.ts @@ -466,9 +466,7 @@ export class RenderPipeline { ); outputNode = scenePassColor.mul(mix(float(1.0), aoValue, this.uAOIntensity)); } else { - // Full-res AO - temporarily disabled normal pass to test if MRT normals - // are causing InstancedMesh artifacts. Passing null forces depth-based - // normal reconstruction. + // Full-res AO with scene normals for accurate occlusion const result = createGTAOPass( scenePassDepth, this.camera, @@ -476,7 +474,7 @@ export class RenderPipeline { radius: this.config.aoRadius, intensity: this.config.aoIntensity, }, - null // TODO: Fix InstancedMesh normal issue then restore scenePassNormal + scenePassNormal ); if (result) { this.aoPass = result.pass; diff --git a/src/rendering/tsl/effects/EffectPasses.ts b/src/rendering/tsl/effects/EffectPasses.ts index ad288dfe..8a070940 100644 --- a/src/rendering/tsl/effects/EffectPasses.ts +++ b/src/rendering/tsl/effects/EffectPasses.ts @@ -202,6 +202,11 @@ export function createGTAOPass( // The ao() function accepts null for normalNode even though types say otherwise const aoPass = ao(scenePassDepth, scenePassNormal ?? (null as any), camera); aoPass.radius.value = config.radius; + // Set thickness to help with depth discontinuity artifacts on InstancedMesh + // Higher thickness = more tolerance for depth differences = fewer edge artifacts + if (aoPass.thickness) { + aoPass.thickness.value = 0.5; + } const aoValueNode = aoPass.getTextureNode().r; return { pass: aoPass, aoValueNode };