Skip to content

Commit

Permalink
fix: use correct value for LinearSRGBColorSpace (pmndrs#368)
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett authored May 24, 2024
1 parent bdfe295 commit 430ffd7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/math/Lut.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class Lut {
const min = this.map[j][0]
const max = this.map[j + 1][0]

minColor.setHex(this.map[j][1], 'linear-srgb')
maxColor.setHex(this.map[j + 1][1], 'linear-srgb')
minColor.setHex(this.map[j][1], 'srgb-linear')
maxColor.setHex(this.map[j + 1][1], 'srgb-linear')

const color = new Color().lerpColors(minColor, maxColor, (alpha - min) / (max - min))

Expand Down Expand Up @@ -131,8 +131,8 @@ class Lut {
const min = this.map[j - 1][0]
const max = this.map[j][0]

minColor.setHex(this.map[j - 1][1], 'linear-srgb')
maxColor.setHex(this.map[j][1], 'linear-srgb')
minColor.setHex(this.map[j - 1][1], 'srgb-linear')
maxColor.setHex(this.map[j][1], 'srgb-linear')

finalColor.lerpColors(minColor, maxColor, (i - min) / (max - min))

Expand Down
2 changes: 1 addition & 1 deletion src/objects/Reflector.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class Reflector extends Mesh {

renderer.xr.enabled = false // Avoid camera modification
renderer.shadowMap.autoUpdate = false // Avoid re-computing shadows
if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'linear-srgb'
if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'
else renderer.outputEncoding = 3000 // LinearEncoding
renderer.toneMapping = NoToneMapping

Expand Down
2 changes: 1 addition & 1 deletion src/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ class Refractor extends Mesh {

renderer.xr.enabled = false // avoid camera modification
renderer.shadowMap.autoUpdate = false // avoid re-computing shadows
if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'linear-srgb'
if ('outputColorSpace' in renderer) renderer.outputColorSpace = 'srgb-linear'
else renderer.outputEncoding = 3000 // LinearEncoding
renderer.toneMapping = NoToneMapping

Expand Down

0 comments on commit 430ffd7

Please sign in to comment.