Pārlūkot izejas kodu

fixed SAO sample + fixed lost of scaling in recent shader change

Nicolas Cannasse 7 gadi atpakaļ
vecāks
revīzija
f426e9d0a8
2 mainītis faili ar 4 papildinājumiem un 5 dzēšanām
  1. 2 2
      h3d/shader/SAO.hx
  2. 2 3
      samples/Sao.hx

+ 2 - 2
h3d/shader/SAO.hx

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

+ 2 - 3
samples/Sao.hx

@@ -44,6 +44,7 @@ class CustomRenderer extends h3d.scene.DefaultRenderer {
 			var saoTarget = allocTarget("sao");
 			setTarget(saoTarget);
 			sao.apply(depth, normal, ctx.camera);
+			resetTarget();
 			bench.measure("saoBlur");
 			saoBlur.apply(ctx, saoTarget);
 			bench.measure("saoBlend");
@@ -141,10 +142,8 @@ class Sao extends SampleApp {
 			r.mode = 1;
 		if(K.isPressed(K.NUMBER_3))
 			r.mode = 2;
-		#if hl
 		if( K.isPressed("V".code) )
-			@:privateAccess hxd.Stage.getInstance().window.vsync = !hxd.Stage.getInstance().window.vsync;
-		#end
+			hxd.Window.getInstance().vsync = !hxd.Window.getInstance().vsync;
 	}
 
 	static function main() {