Skip to content

Commit d6c2bd9

Browse files
fix(N8AO): compat for sRGB chunk renames (#295)
1 parent 7507a62 commit d6c2bd9

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/effects/N8AO/EffectCompositer.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import * as THREE from 'three'
22

3+
const version = parseInt(THREE.REVISION.replace(/\D+/g, ''))
4+
5+
// https://github.com/mrdoob/three.js/pull/26644
6+
// https://github.com/mrdoob/three.js/pull/28901
7+
const sRGBTransferOETF = version >= 167 ? 'sRGBTransferOETF' : 'LinearTosRGB'
8+
39
const EffectCompositer = {
410
uniforms: {
511
sceneDiffuse: { value: null },
@@ -244,7 +250,7 @@ const EffectCompositer = {
244250
}
245251
#include <dithering_fragment>
246252
if (gammaCorrection) {
247-
gl_FragColor = LinearTosRGB(gl_FragColor);
253+
gl_FragColor = ${sRGBTransferOETF}(gl_FragColor);
248254
}
249255
}
250256
`,

0 commit comments

Comments
 (0)