Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TAARenderPass: Fix color shift. #26199

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/jsm/postprocessing/TAARenderPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ class TAARenderPass extends SSAARenderPass {
const oldClearAlpha = renderer.getClearAlpha();

const sampleWeight = 1.0 / ( jitterOffsets.length );
const accumulationWeight = this.accumulateIndex * sampleWeight;

if ( this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length ) {

Expand Down Expand Up @@ -117,6 +116,7 @@ class TAARenderPass extends SSAARenderPass {
}

renderer.setClearColor( this.clearColor, this.clearAlpha );
const accumulationWeight = this.accumulateIndex * sampleWeight;

if ( accumulationWeight > 0 ) {

Expand All @@ -133,7 +133,6 @@ class TAARenderPass extends SSAARenderPass {
this.copyUniforms[ 'opacity' ].value = 1.0 - accumulationWeight;
this.copyUniforms[ 'tDiffuse' ].value = this.holdRenderTarget.texture;
renderer.setRenderTarget( writeBuffer );
if ( accumulationWeight === 0 ) renderer.clear();
Copy link
Collaborator Author

@Mugen87 Mugen87 Jun 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem was this clear operation. When it happens, it deletes the contents of the previous render which explains the flash at the beginning of the accumulation phase.

this.fsQuad.render( renderer );

}
Expand Down