Skip to content

Commit 7b21022

Browse files
fix CustomToneMapping in Post Processing OutputPass and OutputShader (#30335)
Co-authored-by: Francesco Sampoli <[email protected]>
1 parent add425d commit 7b21022

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

examples/jsm/postprocessing/OutputPass.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
AgXToneMapping,
99
ACESFilmicToneMapping,
1010
NeutralToneMapping,
11+
CustomToneMapping,
1112
SRGBTransfer
1213
} from 'three';
1314
import { Pass, FullScreenQuad } from './Pass.js';
@@ -63,6 +64,7 @@ class OutputPass extends Pass {
6364
else if ( this._toneMapping === ACESFilmicToneMapping ) this.material.defines.ACES_FILMIC_TONE_MAPPING = '';
6465
else if ( this._toneMapping === AgXToneMapping ) this.material.defines.AGX_TONE_MAPPING = '';
6566
else if ( this._toneMapping === NeutralToneMapping ) this.material.defines.NEUTRAL_TONE_MAPPING = '';
67+
else if ( this._toneMapping === CustomToneMapping ) this.material.defines.CUSTOM_TONE_MAPPING = '';
6668

6769
this.material.needsUpdate = true;
6870

examples/jsm/shaders/OutputShader.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const OutputShader = {
2828
}`,
2929

3030
fragmentShader: /* glsl */`
31-
31+
3232
precision highp float;
3333
3434
uniform sampler2D tDiffuse;
@@ -68,6 +68,10 @@ const OutputShader = {
6868
6969
gl_FragColor.rgb = NeutralToneMapping( gl_FragColor.rgb );
7070
71+
#elif defined( CUSTOM_TONE_MAPPING )
72+
73+
gl_FragColor.rgb = CustomToneMapping( gl_FragColor.rgb );
74+
7175
#endif
7276
7377
// color space

0 commit comments

Comments
 (0)