diff --git a/src/buffer/buffer.ts b/src/buffer/buffer.ts index 4ea54c98..4bf8d0b3 100755 --- a/src/buffer/buffer.ts +++ b/src/buffer/buffer.ts @@ -181,13 +181,13 @@ class Buffer { emissive: { value: new Color(0x000000) }, roughness: { value: this.parameters.roughness }, metalness: { value: this.parameters.metalness }, - interiorColor: { value: new Color(this.parameters.interiorColor) }, + interiorColor: { value: new Color(this.parameters.interiorColor).convertSRGBToLinear() }, interiorDarkening: { value: this.parameters.interiorDarkening }, }, UniformsLib.lights ]) - this.uniforms.diffuse.value.set(this.parameters.diffuse) + this.uniforms.diffuse.value.set(new Color(this.parameters.diffuse).convertSRGBToLinear()) this.pickingUniforms = { clipNear: { value: 0.0 }, diff --git a/src/color/colormaker.ts b/src/color/colormaker.ts index 0f2302af..6f8b69fb 100644 --- a/src/color/colormaker.ts +++ b/src/color/colormaker.ts @@ -51,7 +51,7 @@ const tmpColor = new Color() * @param c normalized ([0-1]) component vale * @returns linearized value */ -function SRGBToLinear( c: number ) { +export function SRGBToLinear( c: number ) { return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 ); } diff --git a/src/viewer/viewer.ts b/src/viewer/viewer.ts index 9017c63f..330f3eb7 100644 --- a/src/viewer/viewer.ts +++ b/src/viewer/viewer.ts @@ -316,9 +316,9 @@ export default class Viewer { clipMode: 'scene', clipScale: 'relative', - lightColor: new Color(0xdddddd), + lightColor: new Color(0xdddddd).convertSRGBToLinear(), lightIntensity: 3.14, - ambientColor: new Color(0xdddddd), + ambientColor: new Color(0xdddddd).convertSRGBToLinear(), ambientIntensity: 0.63, sampleLevel: 0,