fix:make zerocolor edge

This commit is contained in:
lennlouisgeek
2026-02-04 03:18:20 +08:00
parent ca3545b8b0
commit 001685b633
157 changed files with 31832 additions and 32681 deletions

View File

@@ -48,6 +48,14 @@ vec3 colorRamp(float t) {
return mix(uColorMid, uColorHigh, (t - 0.5) / 0.5);
}
vec3 colorRampWithZero(float t) {
const float zeroW = 0.005;
float blend = smoothstep(0.0, zeroW, t);
float tRamp = saturate((t - zeroW) / max(1.0 - zeroW, 1e-6));
vec3 ramp = colorRamp(tRamp);
return mix(uColorZero, ramp, blend);
}
void main() {
float vC = texture(uHeightTex, vUV).r;
bool isZero = abs(vC) <= 1e-6;
@@ -56,7 +64,7 @@ void main() {
float eps = max(1e-4, 0.001 * (uMaxV - uMinV));
float force = smoothstep(uMaxV - eps, uMaxV, m);
t = max(t, force);
vec3 base = isZero ? uColorZero : colorRamp(t);
vec3 base = isZero ? uColorZero : colorRampWithZero(t);
float vL = texture(uHeightTex, vUV - vec2(uTexelSize.x, 0.0)).r;
float vR = texture(uHeightTex, vUV + vec2(uTexelSize.x, 0.0)).r;