From 27ed0fbf7989c1dc99017195a9e26d4bd79a759e Mon Sep 17 00:00:00 2001 From: chenchun Date: Wed, 2 Sep 2026 23:07:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Dark=20=E4=B8=BB=E9=A2=98=E7=8E=BB?= =?UTF-8?q?=E7=92=83=E6=A8=A1=E5=9E=8B=E9=A2=9C=E8=89=B2=E5=81=8F=E5=B7=AE?= =?UTF-8?q?=20=E2=80=94=20Hard=20Light=20=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E5=AF=B9=E9=BD=90=E5=8E=9F=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原版按 tint 色逐通道 step(vec3(0.5), blend) 选择 multiply/screen; 移植时误写成按 base 标量 step(0.5, base)。Beer-Lambert 分支(Light) 不受影响,Dark 分支(uDark=1 Hard-Light 双色调)因选择器变量错误 导致整体色偏,尤其 tint 色 #64c3ff/#8e9dc4 各通道跨 0.5 时。 与原版逐行 diff 玻璃 fragment shader 确认无其它实质差异。 --- components/canvas/GlassModels.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/components/canvas/GlassModels.tsx b/components/canvas/GlassModels.tsx index 5ebef4a..93022e7 100644 --- a/components/canvas/GlassModels.tsx +++ b/components/canvas/GlassModels.tsx @@ -213,11 +213,14 @@ void main() { float tintK_hard = clamp(uTintEnabled, 0.0, 1.0) * clamp(uTintMix, 0.0, 1.0) * tintAlpha; vec3 baseClamped = clamp(color, 0.0, 1.0); vec3 blendClamped = clamp(tintColorGradient.rgb, 0.0, 1.0); - // Hard Light blend: 2*blend*base where base < 0.5, screen elsewhere + // Hard Light blend(原版逐通道):blend 通道 > 0.5 → screen,否则 multiply。 + // 注意选择器是 blend(tint 色)而非 base —— 暗色主题的 #64c3ff/#8e9dc4 + // 各通道跨 0.5,选错变量会导致 Dark 下模型颜色整体偏差。 + vec3 h = step(vec3(0.5), blendClamped); vec3 hard = mix( - 2.0 * blendClamped * baseClamped, + 2.0 * baseClamped * blendClamped, 1.0 - 2.0 * (1.0 - blendClamped) * (1.0 - baseClamped), - step(0.5, baseClamped) + h ); vec3 hardColor = mix(color, hard, tintK_hard);