Pārlūkot izejas kodu

WebGPURenderer: apply color space/tonemapping if required in clear() (#28521)

* run color/tone mapping pass

* added description

---------

Co-authored-by: aardgoose <[email protected]>
aardgoose 1 gadu atpakaļ
vecāks
revīzija
f52b71b607
1 mainītis faili ar 10 papildinājumiem un 0 dzēšanām
  1. 10 0
      examples/jsm/renderers/common/Renderer.js

+ 10 - 0
examples/jsm/renderers/common/Renderer.js

@@ -944,6 +944,16 @@ class Renderer {
 
 		this.backend.clear( color, depth, stencil, renderTargetData );
 
+		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.
+
+			_quad.material.fragmentNode = this._nodes.getOutputNode( renderTarget.texture );
+			this._renderScene( _quad, _quad.camera, false );
+
+		}
+
 	}
 
 	clearColor() {