|
@@ -35,12 +35,12 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
|
|
|
|
|
|
render: function ( renderer, writeBuffer, readBuffer, delta ) {
|
|
|
|
|
|
- if( ! this.accumulate ) {
|
|
|
+ if ( ! this.accumulate ) {
|
|
|
|
|
|
- THREE.SSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
|
|
|
+ THREE.SSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
|
|
|
|
|
|
- this.accumulateIndex = -1;
|
|
|
- return;
|
|
|
+ this.accumulateIndex = - 1;
|
|
|
+ return;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -60,11 +60,11 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
|
|
|
|
|
|
}
|
|
|
|
|
|
- if( this.accumulate && this.accumulateIndex === -1 ) {
|
|
|
+ if ( this.accumulate && this.accumulateIndex === - 1 ) {
|
|
|
|
|
|
- THREE.SSAARenderPass.prototype.render.call( this, renderer, this.holdRenderTarget, readBuffer, delta );
|
|
|
+ THREE.SSAARenderPass.prototype.render.call( this, renderer, this.holdRenderTarget, readBuffer, delta );
|
|
|
|
|
|
- this.accumulateIndex = 0;
|
|
|
+ this.accumulateIndex = 0;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -73,7 +73,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
|
|
|
|
|
|
var sampleWeight = 1.0 / ( jitterOffsets.length );
|
|
|
|
|
|
- if( this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length ) {
|
|
|
+ if ( this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length ) {
|
|
|
|
|
|
this.copyUniforms[ "opacity" ].value = sampleWeight;
|
|
|
this.copyUniforms[ "tDiffuse" ].value = writeBuffer.texture;
|
|
@@ -83,18 +83,23 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
|
|
|
for ( var i = 0; i < numSamplesPerFrame; i ++ ) {
|
|
|
|
|
|
var j = this.accumulateIndex;
|
|
|
- var jitterOffset = jitterOffsets[j];
|
|
|
+ var jitterOffset = jitterOffsets[ j ];
|
|
|
+
|
|
|
if ( this.camera.setViewOffset ) {
|
|
|
+
|
|
|
this.camera.setViewOffset( readBuffer.width, readBuffer.height,
|
|
|
jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625, // 0.0625 = 1 / 16
|
|
|
readBuffer.width, readBuffer.height );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
renderer.render( this.scene, this.camera, writeBuffer, true );
|
|
|
renderer.render( this.scene2, this.camera2, this.sampleRenderTarget, ( this.accumulateIndex === 0 ) );
|
|
|
|
|
|
this.accumulateIndex ++;
|
|
|
- if( this.accumulateIndex >= jitterOffsets.length ) break;
|
|
|
+
|
|
|
+ if ( this.accumulateIndex >= jitterOffsets.length ) break;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
|
|
@@ -103,19 +108,24 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
|
|
|
|
|
|
var accumulationWeight = this.accumulateIndex * sampleWeight;
|
|
|
|
|
|
- if( accumulationWeight > 0 ) {
|
|
|
+ if ( accumulationWeight > 0 ) {
|
|
|
+
|
|
|
this.copyUniforms[ "opacity" ].value = 1.0;
|
|
|
this.copyUniforms[ "tDiffuse" ].value = this.sampleRenderTarget.texture;
|
|
|
renderer.render( this.scene2, this.camera2, writeBuffer, true );
|
|
|
+
|
|
|
}
|
|
|
- if( accumulationWeight < 1.0 ) {
|
|
|
+
|
|
|
+ if ( accumulationWeight < 1.0 ) {
|
|
|
+
|
|
|
this.copyUniforms[ "opacity" ].value = 1.0 - accumulationWeight;
|
|
|
this.copyUniforms[ "tDiffuse" ].value = this.holdRenderTarget.texture;
|
|
|
renderer.render( this.scene2, this.camera2, writeBuffer, ( accumulationWeight === 0 ) );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
renderer.autoClear = autoClear;
|
|
|
|
|
|
}
|
|
|
|
|
|
-});
|
|
|
+} );
|