Explorar o código

fix CustomToneMapping in Post Processing OutputPass and OutputShader (#30335)

Co-authored-by: Francesco Sampoli <sampoli@quest-it.com>
samposoft hai 1 ano
pai
achega
7b21022e42

+ 2 - 0
examples/jsm/postprocessing/OutputPass.js

@@ -8,6 +8,7 @@ import {
 	AgXToneMapping,
 	ACESFilmicToneMapping,
 	NeutralToneMapping,
+	CustomToneMapping,
 	SRGBTransfer
 } from 'three';
 import { Pass, FullScreenQuad } from './Pass.js';
@@ -63,6 +64,7 @@ class OutputPass extends Pass {
 			else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = '';
 			else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = '';
 			else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = '';
+			else if ( this._toneMapping === CustomToneMapping ) this.material.defines.CUSTOM_TONE_MAPPING = '';
 
 			this.material.needsUpdate = true;
 

+ 5 - 1
examples/jsm/shaders/OutputShader.js

@@ -28,7 +28,7 @@ const OutputShader = {
 		}`,
 
 	fragmentShader: /* glsl */`
-	
+
 		precision highp float;
 
 		uniform sampler2D tDiffuse;
@@ -68,6 +68,10 @@ const OutputShader = {
 
 				gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
 
+			#elif defined( CUSTOM_TONE_MAPPING )
+
+				gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
+
 			#endif
 
 			// color space

粤ICP备19079148号