BlueGit

timfa questward

Tighten water sparkles and troughs; use mid scroll speed.

Narrow crest glitter so highlights stay tip-like instead of white blobs, soften body extremes, and sit flow between the slow and 2x rates.

timfa Tim Falken · pushed by timfa

Authored 2026-09-04 · 2 months ago

Hash
55c77b6531cd9f418438335feeb2256719e91c1d
Parent
ebdb070d
1 file changed +20 −20
client/src/render/worldView.js +20 −20
@@ -214,10 +214,10 @@ const WATER_GROUND_FRAG = [
214 214 " vec2 puv = px / 16.0;",
215 215 " vec2 world = vec2(u_tileX, u_tileY) + puv;",
216 216 " float t = u_time;",
217 // ~2× flow speed.
218 " vec2 flow = vec2(t * 0.44, t * 0.28);",
217 // Midpoint between prior slow scroll and the 2× pass.
218 " vec2 flow = vec2(t * 0.33, t * 0.21);",
219 219 " float eps = 0.10;",
220 " vec3 base = vec3(world * 0.85 + flow, t * 0.7);",
220 " vec3 base = vec3(world * 0.85 + flow, t * 0.52);",
221 221 " float nC = fbm(base);",
222 222 " float nL = fbm(base + vec3(-eps, 0.0, 0.0));",
223 223 " float nR = fbm(base + vec3(eps, 0.0, 0.0));",
@@ -225,18 +225,19 @@ const WATER_GROUND_FRAG = [
225 225 " float nU = fbm(base + vec3(0.0, eps, 0.0));",
226 226 " vec2 distort = vec2(nL - nR, nD - nU) * 0.14;",
227 227 " float texN = texture2D(u_texture, wrapUv(world * 0.28 + flow * 0.6 + distort)).r;",
228 " float h = nC * 0.9 + (texN - 0.5) * 0.22;",
229 " vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.85));",
228 " float h = nC * 0.75 + (texN - 0.5) * 0.18;",
229 " vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.9));",
230 230 " float ndotl = clamp(dot(normal, normalize(vec3(-0.55, -0.5, 0.75))), 0.0, 1.0);",
231 " float wave = h * 0.5 + 0.5;",
232 " float crest = smoothstep(0.58, 0.90, wave);",
233 " float glitter = max(pow(max(0.0, ndotl), 5.5) * crest, pow(crest, 2.8) * 0.85);",
231 " float wave = clamp(h * 0.42 + 0.5, 0.0, 1.0);",
232 // Narrow tip sparkles — avoid wide white plateaus.
233 " float crest = pow(smoothstep(0.72, 0.96, wave), 2.2);",
234 " float glitter = pow(max(0.0, ndotl), 7.5) * crest;",
235 " glitter = max(glitter, pow(crest, 2.5) * 0.55);",
234 236 " float edgeProx = 0.0;",
235 237 " if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",
236 238 " if (u_edgeS > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.y)); }",
237 239 " if (u_edgeW > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.x)); }",
238 240 " if (u_edgeE > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.x)); }",
239 // Stronger diagonal corner reach so land-point pockets clip (WWW vs land wedge).
240 241 " if (u_edgeNE > 0.5) {",
241 242 " edgeProx = max(edgeProx, 1.0 - smoothstep(0.0, 0.78, length(vec2(1.0 - puv.x, puv.y))));",
242 243 " }",
@@ -253,19 +254,18 @@ const WATER_GROUND_FRAG = [
253 254 " float deepTop = mix(u_deepNW, u_deepNE, puv.x);",
254 255 " float deepBot = mix(u_deepSW, u_deepSE, puv.x);",
255 256 " float deepMix = mix(deepTop, deepBot, puv.y);",
256 // More contrast: deeper troughs, brighter crests — still blue, not black.
257 " vec3 deepCol = mix(vec3(0.10, 0.32, 0.52), vec3(0.05, 0.18, 0.38), deepMix);",
258 " vec3 midCol = mix(vec3(0.22, 0.50, 0.68), vec3(0.10, 0.30, 0.50), deepMix);",
259 " vec3 litCol = mix(vec3(0.58, 0.82, 0.94), vec3(0.32, 0.55, 0.74), deepMix);",
260 " vec3 sparkCol = mix(vec3(1.0, 1.0, 1.0), vec3(0.82, 0.94, 1.0), deepMix);",
257 " vec3 deepCol = mix(vec3(0.12, 0.34, 0.54), vec3(0.07, 0.22, 0.42), deepMix);",
258 " vec3 midCol = mix(vec3(0.24, 0.52, 0.70), vec3(0.12, 0.34, 0.54), deepMix);",
259 " vec3 litCol = mix(vec3(0.52, 0.78, 0.90), vec3(0.30, 0.52, 0.72), deepMix);",
260 " vec3 sparkCol = mix(vec3(0.98, 1.0, 1.0), vec3(0.78, 0.92, 1.0), deepMix);",
261 261 " vec3 foamCol = vec3(0.94, 0.99, 1.0);",
262 // Soft trough ramp; keep crest side relatively crisp.
263 " float shade = mix(0.82, 1.10, ndotl);",
264 " vec3 rgb = mix(deepCol, midCol, smoothstep(0.02, 0.78, waveBody));",
265 " rgb = mix(rgb, litCol, smoothstep(0.48, 0.92, waveBody) * 0.55);",
262 // Gentler body contrast so troughs/crests don't form flat dark/white blobs.
263 " float shade = mix(0.90, 1.06, ndotl);",
264 " vec3 rgb = mix(deepCol, midCol, smoothstep(0.12, 0.72, waveBody));",
265 " rgb = mix(rgb, litCol, smoothstep(0.52, 0.90, waveBody) * 0.40);",
266 266 " rgb *= shade;",
267 " rgb = mix(rgb, sparkCol, clamp(glitter * 1.45, 0.0, 1.0) * (1.0 - edgeProx * 0.7));",
268 " rgb = mix(rgb, deepCol, edgeProx * 0.45);",
267 " rgb = mix(rgb, sparkCol, min(glitter, 0.72) * 0.80 * (1.0 - edgeProx * 0.7));",
268 " rgb = mix(rgb, deepCol, edgeProx * 0.40);",
269 269 " float shoreW = 0.0;",
270 270 " vec3 shoreRgb = rgb;",
271 271 " if (u_edgeN > 0.5) {",
@@ -214,10 +214,10 @@ const WATER_GROUND_FRAG = [
214 " vec2 puv = px / 16.0;",
214 " vec2 puv = px / 16.0;",
215 " vec2 world = vec2(u_tileX, u_tileY) + puv;",
215 " vec2 world = vec2(u_tileX, u_tileY) + puv;",
216 " float t = u_time;",
216 " float t = u_time;",
217 // ~2× flow speed.
217 // Midpoint between prior slow scroll and the 2× pass.
218 " vec2 flow = vec2(t * 0.44, t * 0.28);",
218 " vec2 flow = vec2(t * 0.33, t * 0.21);",
219 " float eps = 0.10;",
219 " float eps = 0.10;",
220 " vec3 base = vec3(world * 0.85 + flow, t * 0.7);",
220 " vec3 base = vec3(world * 0.85 + flow, t * 0.52);",
221 " float nC = fbm(base);",
221 " float nC = fbm(base);",
222 " float nL = fbm(base + vec3(-eps, 0.0, 0.0));",
222 " float nL = fbm(base + vec3(-eps, 0.0, 0.0));",
223 " float nR = fbm(base + vec3(eps, 0.0, 0.0));",
223 " float nR = fbm(base + vec3(eps, 0.0, 0.0));",
@@ -225,18 +225,19 @@ const WATER_GROUND_FRAG = [
225 " float nU = fbm(base + vec3(0.0, eps, 0.0));",
225 " float nU = fbm(base + vec3(0.0, eps, 0.0));",
226 " vec2 distort = vec2(nL - nR, nD - nU) * 0.14;",
226 " vec2 distort = vec2(nL - nR, nD - nU) * 0.14;",
227 " float texN = texture2D(u_texture, wrapUv(world * 0.28 + flow * 0.6 + distort)).r;",
227 " float texN = texture2D(u_texture, wrapUv(world * 0.28 + flow * 0.6 + distort)).r;",
228 " float h = nC * 0.9 + (texN - 0.5) * 0.22;",
228 " float h = nC * 0.75 + (texN - 0.5) * 0.18;",
229 " vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.85));",
229 " vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.9));",
230 " float ndotl = clamp(dot(normal, normalize(vec3(-0.55, -0.5, 0.75))), 0.0, 1.0);",
230 " float ndotl = clamp(dot(normal, normalize(vec3(-0.55, -0.5, 0.75))), 0.0, 1.0);",
231 " float wave = h * 0.5 + 0.5;",
231 " float wave = clamp(h * 0.42 + 0.5, 0.0, 1.0);",
232 " float crest = smoothstep(0.58, 0.90, wave);",
232 // Narrow tip sparkles — avoid wide white plateaus.
233 " float glitter = max(pow(max(0.0, ndotl), 5.5) * crest, pow(crest, 2.8) * 0.85);",
233 " float crest = pow(smoothstep(0.72, 0.96, wave), 2.2);",
234 " float glitter = pow(max(0.0, ndotl), 7.5) * crest;",
235 " glitter = max(glitter, pow(crest, 2.5) * 0.55);",
234 " float edgeProx = 0.0;",
236 " float edgeProx = 0.0;",
235 " if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",
237 " if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",
236 " if (u_edgeS > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.y)); }",
238 " if (u_edgeS > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.y)); }",
237 " if (u_edgeW > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.x)); }",
239 " if (u_edgeW > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.x)); }",
238 " if (u_edgeE > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.x)); }",
240 " if (u_edgeE > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, 1.0 - puv.x)); }",
239 // Stronger diagonal corner reach so land-point pockets clip (WWW vs land wedge).
240 " if (u_edgeNE > 0.5) {",
241 " if (u_edgeNE > 0.5) {",
241 " edgeProx = max(edgeProx, 1.0 - smoothstep(0.0, 0.78, length(vec2(1.0 - puv.x, puv.y))));",
242 " edgeProx = max(edgeProx, 1.0 - smoothstep(0.0, 0.78, length(vec2(1.0 - puv.x, puv.y))));",
242 " }",
243 " }",
@@ -253,19 +254,18 @@ const WATER_GROUND_FRAG = [
253 " float deepTop = mix(u_deepNW, u_deepNE, puv.x);",
254 " float deepTop = mix(u_deepNW, u_deepNE, puv.x);",
254 " float deepBot = mix(u_deepSW, u_deepSE, puv.x);",
255 " float deepBot = mix(u_deepSW, u_deepSE, puv.x);",
255 " float deepMix = mix(deepTop, deepBot, puv.y);",
256 " float deepMix = mix(deepTop, deepBot, puv.y);",
256 // More contrast: deeper troughs, brighter crests — still blue, not black.
257 " vec3 deepCol = mix(vec3(0.12, 0.34, 0.54), vec3(0.07, 0.22, 0.42), deepMix);",
257 " vec3 deepCol = mix(vec3(0.10, 0.32, 0.52), vec3(0.05, 0.18, 0.38), deepMix);",
258 " vec3 midCol = mix(vec3(0.24, 0.52, 0.70), vec3(0.12, 0.34, 0.54), deepMix);",
258 " vec3 midCol = mix(vec3(0.22, 0.50, 0.68), vec3(0.10, 0.30, 0.50), deepMix);",
259 " vec3 litCol = mix(vec3(0.52, 0.78, 0.90), vec3(0.30, 0.52, 0.72), deepMix);",
259 " vec3 litCol = mix(vec3(0.58, 0.82, 0.94), vec3(0.32, 0.55, 0.74), deepMix);",
260 " vec3 sparkCol = mix(vec3(0.98, 1.0, 1.0), vec3(0.78, 0.92, 1.0), deepMix);",
260 " vec3 sparkCol = mix(vec3(1.0, 1.0, 1.0), vec3(0.82, 0.94, 1.0), deepMix);",
261 " vec3 foamCol = vec3(0.94, 0.99, 1.0);",
261 " vec3 foamCol = vec3(0.94, 0.99, 1.0);",
262 // Soft trough ramp; keep crest side relatively crisp.
262 // Gentler body contrast so troughs/crests don't form flat dark/white blobs.
263 " float shade = mix(0.82, 1.10, ndotl);",
263 " float shade = mix(0.90, 1.06, ndotl);",
264 " vec3 rgb = mix(deepCol, midCol, smoothstep(0.02, 0.78, waveBody));",
264 " vec3 rgb = mix(deepCol, midCol, smoothstep(0.12, 0.72, waveBody));",
265 " rgb = mix(rgb, litCol, smoothstep(0.48, 0.92, waveBody) * 0.55);",
265 " rgb = mix(rgb, litCol, smoothstep(0.52, 0.90, waveBody) * 0.40);",
266 " rgb *= shade;",
266 " rgb *= shade;",
267 " rgb = mix(rgb, sparkCol, clamp(glitter * 1.45, 0.0, 1.0) * (1.0 - edgeProx * 0.7));",
267 " rgb = mix(rgb, sparkCol, min(glitter, 0.72) * 0.80 * (1.0 - edgeProx * 0.7));",
268 " rgb = mix(rgb, deepCol, edgeProx * 0.45);",
268 " rgb = mix(rgb, deepCol, edgeProx * 0.40);",
269 " float shoreW = 0.0;",
269 " float shoreW = 0.0;",
270 " vec3 shoreRgb = rgb;",
270 " vec3 shoreRgb = rgb;",
271 " if (u_edgeN > 0.5) {",
271 " if (u_edgeN > 0.5) {",