瀏覽代碼

Merge pull request #13295 from Mugen87/dev8

SAOPass: Fix orthographic camera support
Mr.doob 7 年之前
父節點
當前提交
de5125a355
共有 2 個文件被更改,包括 3 次插入1 次删除
  1. 2 0
      examples/js/postprocessing/SAOPass.js
  2. 1 1
      examples/js/shaders/DepthLimitedBlurShader.js

+ 2 - 0
examples/js/postprocessing/SAOPass.js

@@ -100,6 +100,7 @@ THREE.SAOPass = function ( scene, camera, depthTexture, useNormals, resolution )
 		fragmentShader: THREE.DepthLimitedBlurShader.fragmentShader
 	} );
 	this.vBlurMaterial.defines[ 'DEPTH_PACKING' ] = this.supportsDepthTextureExtension ? 0 : 1;
+	this.vBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
 	this.vBlurMaterial.uniforms[ 'tDiffuse' ].value = this.saoRenderTarget.texture;
 	this.vBlurMaterial.uniforms[ 'tDepth' ].value = ( this.supportsDepthTextureExtension ) ? depthTexture : this.depthRenderTarget.texture;
 	this.vBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );
@@ -112,6 +113,7 @@ THREE.SAOPass = function ( scene, camera, depthTexture, useNormals, resolution )
 		fragmentShader: THREE.DepthLimitedBlurShader.fragmentShader
 	} );
 	this.hBlurMaterial.defines[ 'DEPTH_PACKING' ] = this.supportsDepthTextureExtension ? 0 : 1;
+	this.hBlurMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
 	this.hBlurMaterial.uniforms[ 'tDiffuse' ].value = this.blurIntermediateRenderTarget.texture;
 	this.hBlurMaterial.uniforms[ 'tDepth' ].value = ( this.supportsDepthTextureExtension ) ? depthTexture : this.depthRenderTarget.texture;
 	this.hBlurMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );

+ 1 - 1
examples/js/shaders/DepthLimitedBlurShader.js

@@ -59,7 +59,7 @@ THREE.DepthLimitedBlurShader = {
 		"	#if PERSPECTIVE_CAMERA == 1",
 		"	return perspectiveDepthToViewZ( depth, cameraNear, cameraFar );",
 		"	#else",
-		"	return orthoDepthToViewZ( depth, cameraNear, cameraFar );",
+		"	return orthographicDepthToViewZ( depth, cameraNear, cameraFar );",
 		"	#endif",
 		"}",