BlueGit

timfa questward

Make lava coasts fully clip to the tile edge like water.

Bright lava never reached shoreClip before, so heat ran to the quad edge. Retreat now always covers the outer band; noise only wiggles how far inland the black stop sits.

timfa Tim Falken · pushed by timfa

Authored 2026-09-04 · 2 months ago

Hash
5c798a7cb1af5d174a96331cdf088ef0b69656e8
Parent
bf90ead9
2 files changed +8 −7
client/src/play/waterDebug.js +1 −1
@@ -70,7 +70,7 @@ export const DEFAULT_LAVA_DEBUG = Object.freeze({
70 70 lightDirZ: 0.78,
71 71 normalEps: 0.09,
72 72 bloomStrength: 0.9,
73 shoreClip: 0.4
73 shoreClip: 0.55
74 74 });
75 75
76 76 const WATER_SLIDERS = [
@@ -70,7 +70,7 @@ export const DEFAULT_LAVA_DEBUG = Object.freeze({
70 lightDirZ: 0.78,
70 lightDirZ: 0.78,
71 normalEps: 0.09,
71 normalEps: 0.09,
72 bloomStrength: 0.9,
72 bloomStrength: 0.9,
73 shoreClip: 0.4
73 shoreClip: 0.55
74});
74});
75
75
76const WATER_SLIDERS = [
76const WATER_SLIDERS = [
client/src/render/worldView.js +7 −6
@@ -507,17 +507,18 @@ const LAVA_GROUND_FRAG = [
507 507 " rgb = mix(rgb, yellow, yellowAmt);",
508 508 " float shade = mix(u_shadeLo, u_shadeHi, ndotl);",
509 509 " rgb *= shade;",
510 " rgb = mix(rgb, darkRed, edgeProx * u_edgeDark);",
510 " rgb = mix(rgb, darkRed, edgeProx * u_edgeDark * 0.35);",
511 // Coast: outer pixels always stop (black); noise only wiggles how far inland.
511 512 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
512 " float retreat = edgeProx * (0.35 + 0.65 * darkAmt);",
513 " float retreat = edgeProx * mix(0.72, 1.0, darkAmt);",
513 514 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
514 515 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
515 516 " float shoreW = step(0.5, hasEdge);",
516 517 " float shoreClip = u_shoreClip;",
517 518 " float shoreMask = step(shoreClip, retreat) * shoreW;",
518 " float crustAmt = (1.0 - shoreMask) * smoothstep(shoreClip - 0.24, shoreClip - 0.08, retreat)",
519 " * (1.0 - smoothstep(shoreClip - 0.08, shoreClip, retreat));",
520 " rgb = mix(rgb, vec3(0.04, 0.01, 0.0), crustAmt);",
519 " float crustAmt = (1.0 - shoreMask) * smoothstep(shoreClip - 0.2, shoreClip - 0.06, retreat)",
520 " * (1.0 - smoothstep(shoreClip - 0.06, shoreClip, retreat));",
521 " rgb = mix(rgb, vec3(0.05, 0.01, 0.0), crustAmt);",
521 522 " rgb = mix(rgb, vec3(0.0), shoreMask);",
522 523 " float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",
523 524 " float litBottom = mix(u_litSW, u_litSE, v_texCoord.x);",
@@ -617,7 +618,7 @@ const LAVA_BLOOM_FRAG = [
617 618 " heat = mix(heat, 1.0, smoothstep(u_litLo, max(u_litHi, u_litLo + 0.01), waveBody) * u_litMix * 0.35);",
618 619 " heat = clamp(heat + min(glitter, u_glitterCap) * u_glitterMix * 0.45, 0.0, 1.0);",
619 620 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
620 " float retreat = edgeProx * (0.35 + 0.65 * darkAmt);",
621 " float retreat = edgeProx * mix(0.72, 1.0, darkAmt);",
621 622 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
622 623 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
623 624 " float shoreW = step(0.5, hasEdge);",
@@ -507,17 +507,18 @@ const LAVA_GROUND_FRAG = [
507 " rgb = mix(rgb, yellow, yellowAmt);",
507 " rgb = mix(rgb, yellow, yellowAmt);",
508 " float shade = mix(u_shadeLo, u_shadeHi, ndotl);",
508 " float shade = mix(u_shadeLo, u_shadeHi, ndotl);",
509 " rgb *= shade;",
509 " rgb *= shade;",
510 " rgb = mix(rgb, darkRed, edgeProx * u_edgeDark);",
510 " rgb = mix(rgb, darkRed, edgeProx * u_edgeDark * 0.35);",
511 // Coast: outer pixels always stop (black); noise only wiggles how far inland.
511 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
512 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
512 " float retreat = edgeProx * (0.35 + 0.65 * darkAmt);",
513 " float retreat = edgeProx * mix(0.72, 1.0, darkAmt);",
513 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
514 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
514 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
515 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
515 " float shoreW = step(0.5, hasEdge);",
516 " float shoreW = step(0.5, hasEdge);",
516 " float shoreClip = u_shoreClip;",
517 " float shoreClip = u_shoreClip;",
517 " float shoreMask = step(shoreClip, retreat) * shoreW;",
518 " float shoreMask = step(shoreClip, retreat) * shoreW;",
518 " float crustAmt = (1.0 - shoreMask) * smoothstep(shoreClip - 0.24, shoreClip - 0.08, retreat)",
519 " float crustAmt = (1.0 - shoreMask) * smoothstep(shoreClip - 0.2, shoreClip - 0.06, retreat)",
519 " * (1.0 - smoothstep(shoreClip - 0.08, shoreClip, retreat));",
520 " * (1.0 - smoothstep(shoreClip - 0.06, shoreClip, retreat));",
520 " rgb = mix(rgb, vec3(0.04, 0.01, 0.0), crustAmt);",
521 " rgb = mix(rgb, vec3(0.05, 0.01, 0.0), crustAmt);",
521 " rgb = mix(rgb, vec3(0.0), shoreMask);",
522 " rgb = mix(rgb, vec3(0.0), shoreMask);",
522 " float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",
523 " float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",
523 " float litBottom = mix(u_litSW, u_litSE, v_texCoord.x);",
524 " float litBottom = mix(u_litSW, u_litSE, v_texCoord.x);",
@@ -617,7 +618,7 @@ const LAVA_BLOOM_FRAG = [
617 " heat = mix(heat, 1.0, smoothstep(u_litLo, max(u_litHi, u_litLo + 0.01), waveBody) * u_litMix * 0.35);",
618 " heat = mix(heat, 1.0, smoothstep(u_litLo, max(u_litHi, u_litLo + 0.01), waveBody) * u_litMix * 0.35);",
618 " heat = clamp(heat + min(glitter, u_glitterCap) * u_glitterMix * 0.45, 0.0, 1.0);",
619 " heat = clamp(heat + min(glitter, u_glitterCap) * u_glitterMix * 0.45, 0.0, 1.0);",
619 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
620 " float darkAmt = 1.0 - smoothstep(0.12, 0.48, waveBody);",
620 " float retreat = edgeProx * (0.35 + 0.65 * darkAmt);",
621 " float retreat = edgeProx * mix(0.72, 1.0, darkAmt);",
621 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
622 " float hasEdge = max(max(u_edgeN, u_edgeE), max(u_edgeS, u_edgeW));",
622 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
623 " hasEdge = max(hasEdge, max(max(u_edgeNE, u_edgeNW), max(u_edgeSE, u_edgeSW)));",
623 " float shoreW = step(0.5, hasEdge);",
624 " float shoreW = step(0.5, hasEdge);",