Skip to content

Commit

Permalink
More color space conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
ppillot committed Apr 8, 2024
1 parent 48c0db6 commit b5a3523
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/buffer/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
2 changes: 1 addition & 1 deletion src/color/colormaker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down
4 changes: 2 additions & 2 deletions src/viewer/viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b5a3523

Please sign in to comment.