From 16fbdd5afda976aef5b3da74978b36adfd178bb2 Mon Sep 17 00:00:00 2001 From: wuyize Date: Thu, 11 Apr 2024 22:42:33 +0800 Subject: [PATCH] =?UTF-8?q?Fix:=20SSAO=E8=AE=A1=E7=AE=97=E6=97=B6=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E4=BA=86=E9=94=99=E8=AF=AF=E7=9A=84=E6=B3=95=E5=90=91?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ArchitectureColoredPainting/res/Shaders/ssao.comp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchitectureColoredPainting/res/Shaders/ssao.comp b/ArchitectureColoredPainting/res/Shaders/ssao.comp index 54b7c80..cff2360 100644 --- a/ArchitectureColoredPainting/res/Shaders/ssao.comp +++ b/ArchitectureColoredPainting/res/Shaders/ssao.comp @@ -28,7 +28,7 @@ void main() // get input for SSAO algorithm vec3 worldPos = texelFetch(gPosition, pixelLocation, 0).xyz; vec3 fragPos = (view * vec4(worldPos, 1.0)).xyz; - vec3 normal = normalize((texelFetch(gNormal, pixelLocation, 0).xyz - vec3(0.5)) * 2); + vec3 normal = normalize(mat3(view) * ((texelFetch(gNormal, pixelLocation, 0).xyz - vec3(0.5)) * 2)); vec3 randomVec = normalize(texture(texNoise, vec2(pixelLocation) * noiseScale).xyz); // create TBN change-of-basis matrix: from tangent-space to view-space vec3 tangent = normalize(randomVec - normal * dot(randomVec, normal));