Michael Herzog 1 год назад
Родитель
Сommit
ce402f3e6e
1 измененных файлов с 14 добавлено и 6 удалено
  1. 14 6
      examples/jsm/tsl/display/TRAAPassNode.js

+ 14 - 6
examples/jsm/tsl/display/TRAAPassNode.js

@@ -83,13 +83,20 @@ class TRAAPassNode extends PassNode {
 		this._pixelRatio = renderer.getPixelRatio();
 		const size = renderer.getSize( _size );
 
-		const needsRestart = this.setSize( size.width, size.height, renderer );
+		const needsRestart = this.setSize( size.width, size.height );
 
-		//
+		// save original/unjittered projection matrix for velocity pass
+
+		camera.updateProjectionMatrix();
+		this._originalProjectionMatrix.copy( camera.projectionMatrix );
+
+		// camera configuration
 
 		this._cameraNear.value = camera.near;
 		this._cameraFar.value = camera.far;
 
+		// configure jitter as view offset
+
 		const viewOffset = {
 
 			fullWidth: this.renderTarget.width,
@@ -107,9 +114,6 @@ class TRAAPassNode extends PassNode {
 
 		const jitterOffset = _JitterVectors[ this._jitterIndex ];
 
-		camera.updateProjectionMatrix();
-		this._originalProjectionMatrix.copy( camera.projectionMatrix );
-
 		camera.setViewOffset(
 
 			viewOffset.fullWidth, viewOffset.fullHeight,
@@ -120,6 +124,8 @@ class TRAAPassNode extends PassNode {
 
 		);
 
+		// configure velocity
+
 		const mrt = this.getMRT();
 		const velocityOutput = mrt.get( 'velocity' );
 
@@ -133,6 +139,8 @@ class TRAAPassNode extends PassNode {
 
 		}
 
+		// render sample
+
 		renderer.setMRT( mrt );
 
 		renderer.setClearColor( this.clearColor, this.clearAlpha );
@@ -224,7 +232,7 @@ class TRAAPassNode extends PassNode {
 			velocityTarget.isRenderTargetTexture = true;
 			velocityTarget.name = 'velocity';
 
-			this._sampleRenderTarget.textures.push( velocityTarget );
+			this._sampleRenderTarget.textures.push( velocityTarget ); // for MRT
 
 		}
 

粤ICP备19079148号