Skip to content

Commit

Permalink
Renderer: Disable autoClear in the output pass. (#30454)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mugen87 authored Feb 4, 2025
1 parent d9bc10b commit 8ebbc3e
Showing 1 changed file with 28 additions and 23 deletions.
51 changes: 28 additions & 23 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1408,16 +1408,7 @@ class Renderer {

this.setRenderTarget( outputRenderTarget, activeCubeFace, activeMipmapLevel );

const quad = this._quad;

if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {

quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
quad.material.needsUpdate = true;

}

this._renderScene( quad, quad.camera, false );
this._renderOutput( renderTarget );

}

Expand All @@ -1431,6 +1422,32 @@ class Renderer {

}

/**
* The output pass performs tone mapping and color space conversion.
*
* @private
* @param {RenderTarget} renderTarget - The current render target.
*/
_renderOutput( renderTarget ) {

const quad = this._quad;

if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {

quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
quad.material.needsUpdate = true;

}

// a clear operation clears the intermediate renderTarget texture, but should not update the screen canvas.

const currentAutoClear = this.autoClear;
this.autoClear = false;
this._renderScene( quad, quad.camera, false );
this.autoClear = currentAutoClear;

}

/**
* Returns the maximum available anisotropy for texture filtering.
*
Expand Down Expand Up @@ -1900,19 +1917,7 @@ class Renderer {

if ( renderTarget !== null && this._renderTarget === null ) {

// If a color space transform or tone mapping is required,
// the clear operation clears the intermediate renderTarget texture, but does not update the screen canvas.

const quad = this._quad;

if ( this._nodes.hasOutputChange( renderTarget.texture ) ) {

quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
quad.material.needsUpdate = true;

}

this._renderScene( quad, quad.camera, false );
this._renderOutput( renderTarget );

}

Expand Down

0 comments on commit 8ebbc3e

Please sign in to comment.