Skip to content

Commit

Permalink
fix(N8AO): compat for sRGB chunk renames
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Sep 29, 2024
1 parent 7507a62 commit f06beb8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/effects/N8AO/EffectCompositer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import * as THREE from 'three'

const version = parseInt(THREE.REVISION.replace(/\D+/g, ''))

// https://github.com/mrdoob/three.js/pull/26644
// https://github.com/mrdoob/three.js/pull/28901
const sRGBTransferOETF = version >= 167 ? 'sRGBTransferOETF' : 'LinearTosRGB'

const EffectCompositer = {
uniforms: {
sceneDiffuse: { value: null },
Expand Down Expand Up @@ -244,7 +250,7 @@ const EffectCompositer = {
}
#include <dithering_fragment>
if (gammaCorrection) {
gl_FragColor = LinearTosRGB(gl_FragColor);
gl_FragColor = ${sRGBTransferOETF}(gl_FragColor);
}
}
`,
Expand Down

0 comments on commit f06beb8

Please sign in to comment.