diff --git a/utils/contrast_color.ts b/utils/contrast_color.ts index 2f3e908..7093e14 100644 --- a/utils/contrast_color.ts +++ b/utils/contrast_color.ts @@ -7,7 +7,7 @@ export const contrastColor = (color: ralTypes) => { if (hex) { const hsl = { h: 0, s: 0, l: 0 } new Color(hex).getHSL(hsl) - if (hsl.l < 0.5) { + if (hsl.l < 0.45) { return '#fff' } else { return '#000' diff --git a/utils/material.ts b/utils/material.ts index 12d7b49..94fa2ee 100644 --- a/utils/material.ts +++ b/utils/material.ts @@ -82,22 +82,13 @@ const m_onBeforeCompile = (shader) => { } ${shader.fragmentShader} ` - // .replace( - // `#include `, - // ` - // float noise_v = noise(diffuseColor.rg); - // float clamped_noise = clamp(noise_v, -0.15, 0.15); - // diffuseColor.rgb *= clamped_noise; - // #include - // ` - // ) .replace( `#include `, `#include float noise_v = noise(gl_FragColor.rg); - float clamped_noise = clamp(noise_v, -0.05, 0.05); - gl_FragColor.rgb -= clamp(vec3(clamped_noise), 0.0, 1.0); + float clamped_noise = clamp(noise_v, 0.85, 1.0); + gl_FragColor.rgb *= vec3(clamped_noise); ` ); };