From 430ffd76fed22748dd1ba533b73eaa8286eeaabd Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Fri, 24 May 2024 17:56:48 -0500 Subject: [PATCH] fix: use correct value for LinearSRGBColorSpace (#368) --- src/math/Lut.js | 8 ++++---- src/objects/Reflector.js | 2 +- src/objects/Refractor.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/math/Lut.js b/src/math/Lut.js index a1eadbfa..55425077 100644 --- a/src/math/Lut.js +++ b/src/math/Lut.js @@ -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)) @@ -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)) diff --git a/src/objects/Reflector.js b/src/objects/Reflector.js index ce8ee99e..5d326eb6 100644 --- a/src/objects/Reflector.js +++ b/src/objects/Reflector.js @@ -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 diff --git a/src/objects/Refractor.js b/src/objects/Refractor.js index dedd6c64..09dda320 100644 --- a/src/objects/Refractor.js +++ b/src/objects/Refractor.js @@ -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