Skip to content

Commit

Permalink
Fix regression in OutputPass.
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy committed Aug 25, 2023
1 parent 16a1bf9 commit d9bdfa1
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
5 changes: 3 additions & 2 deletions examples/jsm/postprocessing/OutputPass.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import {
ColorManagement,
RawShaderMaterial,
UniformsUtils,
LinearToneMapping,
ReinhardToneMapping,
CineonToneMapping,
ACESFilmicToneMapping,
SRGBColorSpace
SRGBTransfer
} from 'three';
import { Pass, FullScreenQuad } from './Pass.js';
import { OutputShader } from '../shaders/OutputShader.js';
Expand Down Expand Up @@ -51,7 +52,7 @@ class OutputPass extends Pass {

this.material.defines = {};

if ( this._outputColorSpace == SRGBColorSpace ) this.material.defines.SRGB_COLOR_SPACE = '';
if ( ColorManagement.getTransfer( this._outputColorSpace ) === SRGBTransfer ) this.material.defines.SRGB_TRANSFER = '';

if ( this._toneMapping === LinearToneMapping ) this.material.defines.LINEAR_TONE_MAPPING = '';
else if ( this._toneMapping === ReinhardToneMapping ) this.material.defines.REINHARD_TONE_MAPPING = '';
Expand Down
4 changes: 2 additions & 2 deletions examples/jsm/shaders/OutputShader.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const OutputShader = {
// color space
#ifdef SRGB_COLOR_SPACE
#ifdef SRGB_TRANSFER
gl_FragColor = LinearTosRGB( gl_FragColor );
gl_FragColor = sRGBTransferOETF( gl_FragColor );
#endif
Expand Down
1 change: 0 additions & 1 deletion examples/webgl_test_wide_gamut.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@

import * as THREE from 'three';

import WebGL from 'three/addons/capabilities/WebGL.js';
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';

let container, camera, renderer, loader;
Expand Down
20 changes: 10 additions & 10 deletions src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ export default /* glsl */`
// http://www.russellcottrell.com/photo/matrixCalculator.htm
mat3 REC709_TO_P3 = transpose( mat3(
0.8224621, 0.0331941, 0.0170827,
0.1775380, 0.9668058, 0.0723974,
-0.0000001, 0.0000001, 0.9105199
) );
const mat3 REC709_TO_P3 = mat3(
0.8224621, 0.177538, - 0.0000001,
0.0331941, 0.9668058, 0.0000001,
0.0170827, 0.0723974, 0.9105199
);
mat3 P3_TO_REC709 = transpose( mat3(
1.2249401, - 0.0420569, - 0.0196376,
- 0.2249404, 1.0420571, - 0.0786361,
0.0000001, 0.0000000, 1.0982735
) );
const mat3 P3_TO_REC709 = mat3(
1.2249401, - 0.2249404, 0.0000001,
- 0.0420569, 1.0420571, 0.0000000,
- 0.0196376, - 0.0786361, 1.0982735
);
vec4 Rec709ToP3( in vec4 value ) {
return vec4( value.rgb * REC709_TO_P3, value.a );
Expand Down

0 comments on commit d9bdfa1

Please sign in to comment.