Skip to content

Commit

Permalink
fix CustomToneMapping in Post Processing OutputPass and OutputShader (#…
Browse files Browse the repository at this point in the history
…30335)

Co-authored-by: Francesco Sampoli <[email protected]>
  • Loading branch information
samposoft and SampoliDev authored Jan 16, 2025
1 parent add425d commit 7b21022
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/jsm/postprocessing/OutputPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
AgXToneMapping,
ACESFilmicToneMapping,
NeutralToneMapping,
CustomToneMapping,
SRGBTransfer
} from 'three';
import { Pass, FullScreenQuad } from './Pass.js';
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 5 additions & 1 deletion examples/jsm/shaders/OutputShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const OutputShader = {
}`,

fragmentShader: /* glsl */`
precision highp float;
uniform sampler2D tDiffuse;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7b21022

Please sign in to comment.