Browse Source

Update SSAO

ShiroSmith 6 years ago
parent
commit
00dc1d30d2
1 changed files with 6 additions and 2 deletions
  1. 6 2
      h3d/shader/SAO.hx

+ 6 - 2
h3d/shader/SAO.hx

@@ -66,8 +66,12 @@ class SAO extends ScreenShader {
 			var normal = normalTexture.get(vUV);
 
 			var noiseUv : Vec2;
-			noiseUv = useWorldUV ? origin.xy + origin.z : vUV / screenRatio;
-			var sampleNoise = noiseTexture.get(noiseUv * noiseScale).x;
+			if( useWorldUV )
+				noiseUv = (origin.xy + origin.z) * noiseScale;
+			else
+				noiseUv = vUV / screenRatio * noiseScale;
+
+			var sampleNoise = noiseTexture.get(noiseUv).x;
 			var randomPatternRotationAngle = 2.0 * PI * sampleNoise;
 
 			// change from WS to DepthUV space