瀏覽代碼

Update SSAO

ShiroSmith 6 年之前
父節點
當前提交
00dc1d30d2
共有 1 個文件被更改,包括 6 次插入2 次删除
  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