Răsfoiți Sursa

Delegate cleaning during render pass instead of setting material parameters

Ludovic Bailly 8 ani în urmă
părinte
comite
daa0e8f824

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

@@ -229,13 +229,15 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 		// Re-render scene if depth texture extension is not supported
 		if ( ! this.supportsDepthTextureExtension ) {
 
-			this.renderOverride( renderer, this.depthMaterial, this.depthRenderTarget );
+			// Clear rule : far clipping plane in both RGBA and Basic encoding
+			this.renderOverride( renderer, this.depthMaterial, this.depthRenderTarget, 0xffffff, 1.0 );
 
 		}
 
 		if ( this.supportsNormalTexture ) {
 
-			this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget );
+			// Clear rule : default normal is facing the camera
+			this.renderOverride( renderer, this.normalMaterial, this.normalRenderTarget, 0x7777ff, 1.0 );
 
 		}
 

+ 1 - 1
examples/webgl_postprocessing_sao.html

@@ -151,7 +151,7 @@
 				composer = new THREE.EffectComposer(renderer);
 				renderPass = new THREE.RenderPass(scene, camera);
 				composer.addPass(renderPass);
-				saoPass = new THREE.SAOPass(scene, camera, true, true);
+				saoPass = new THREE.SAOPass(scene, camera, false, true);
 				saoPass.renderToScreen = true;
 				composer.addPass(saoPass);
 

+ 0 - 7
src/materials/MeshDepthMaterial.js

@@ -46,10 +46,6 @@ function MeshDepthMaterial( parameters ) {
 	this.wireframe = false;
 	this.wireframeLinewidth = 1;
 
-	// far clipping plane in both RGBA and Basic encoding
-	this.clearColor = new THREE.Color( 1.0, 1.0, 1.0 );
-	this.clearAlpha = 1.0;
-
 	this.fog = false;
 	this.lights = false;
 
@@ -82,9 +78,6 @@ MeshDepthMaterial.prototype.copy = function ( source ) {
 	this.wireframe = source.wireframe;
 	this.wireframeLinewidth = source.wireframeLinewidth;
 
-	this.clearColor = source.clearColor;
-	this.clearAlpha = source.clearAlpha;
-
 	return this;
 
 };

+ 0 - 7
src/materials/MeshNormalMaterial.js

@@ -46,10 +46,6 @@ function MeshNormalMaterial( parameters ) {
 	this.wireframe = false;
 	this.wireframeLinewidth = 1;
 
-	// default normal is facing the camera.
-	this.clearColor = new THREE.Color( 0.5, 0.5, 1.0 );
-	this.clearAlpha = 1.0;
-
 	this.fog = false;
 	this.lights = false;
 
@@ -83,9 +79,6 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
 	this.wireframe = source.wireframe;
 	this.wireframeLinewidth = source.wireframeLinewidth;
 
-	this.clearColor = source.clearColor;
-	this.clearAlpha = source.clearAlpha;
-
 	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
 	this.morphNormals = source.morphNormals;