Try simplex FBM water with time-ripple and pseudo-normals.
Attempt 3 keeps binary coasts, diagonal land pockets, and corner depth blend from prior experiments; surface uses 4-octave 3D simplex FBM, offset samples for normals/distortion, and specular glitter.
@@ -115,7 +115,6 @@ const WATER_GROUND_FRAG = [
115
115
"uniform float u_time;",
116
116
"uniform float u_tileX;",
117
117
"uniform float u_tileY;",
118
// Corner deepness (avg of liquid water tiles meeting each corner) — bilinear field.
119
118
"uniform float u_deepNW;",
120
119
"uniform float u_deepNE;",
121
120
"uniform float u_deepSW;",
@@ -134,10 +133,62 @@ const WATER_GROUND_FRAG = [
134
133
"uniform float u_shoreEdgeS;",
135
134
"uniform float u_shoreEdgeW;",
136
135
"uniform vec4 u_shoreUvRect;",
137
"vec2 rot2(vec2 p, float a) {",
138
" float c = cos(a);",
139
" float s = sin(a);",
140
" return vec2(c * p.x - s * p.y, s * p.x + c * p.y);",
136
// 3D simplex (Ashima / Gustavson style — OpenSimplex-class continuous field).
137
"vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }",
138
"vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }",
139
"vec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }",
140
"vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }",
141
"float snoise(vec3 v) {",
142
" vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);",
143
" vec4 D = vec4(0.0, 0.5, 1.0, 2.0);",
144
" vec3 i = floor(v + dot(v, C.yyy));",
145
" vec3 x0 = v - i + dot(i, C.xxx);",
146
" vec3 g = step(x0.yzx, x0.xyz);",
147
" vec3 l = 1.0 - g;",
148
" vec3 i1 = min(g.xyz, l.zxy);",
149
" vec3 i2 = max(g.xyz, l.zxy);",
150
" vec3 x1 = x0 - i1 + C.xxx;",
151
" vec3 x2 = x0 - i2 + C.yyy;",
152
" vec3 x3 = x0 - D.yyy;",
153
" i = mod289(i);",
154
" vec4 p = permute(permute(permute(",
155
" i.z + vec4(0.0, i1.z, i2.z, 1.0))",
156
" + i.y + vec4(0.0, i1.y, i2.y, 1.0))",
157
" + i.x + vec4(0.0, i1.x, i2.x, 1.0));",
158
" float n_ = 0.142857142857;",
159
" vec3 ns = n_ * D.wyz - D.xzx;",
160
" vec4 j = p - 49.0 * floor(p * ns.z * ns.z);",
161
" vec4 x_ = floor(j * ns.z);",
162
" vec4 y_ = floor(j - 7.0 * x_);",
163
" vec4 x = x_ * ns.x + ns.yyyy;",
164
" vec4 y = y_ * ns.x + ns.yyyy;",
165
" vec4 h = 1.0 - abs(x) - abs(y);",
166
" vec4 b0 = vec4(x.xy, y.xy);",
167
" vec4 b1 = vec4(x.zw, y.zw);",
168
" vec4 s0 = floor(b0) * 2.0 + 1.0;",
169
" vec4 s1 = floor(b1) * 2.0 + 1.0;",
170
" vec4 sh = -step(h, vec4(0.0));",
171
" vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;",
172
" vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;",
173
" vec3 p0 = vec3(a0.xy, h.x);",
174
" vec3 p1 = vec3(a0.zw, h.y);",
175
" vec3 p2 = vec3(a1.xy, h.z);",
176
" vec3 p3 = vec3(a1.zw, h.w);",
177
" vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));",
178
" p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;",
179
" vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);",
180
" m = m * m;",
181
" return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));",
182
"}",
183
// 4-octave FBM: freq ×2, amp ×0.5 each layer; time in Z for continuous ripple.
184
"float fbm(vec3 p) {",
185
" float sum = 0.0;",
186
" float amp = 0.5;",
187
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",
188
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",
189
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",
190
" sum += amp * snoise(p);",
191
" return sum;",
141
192
"}",
142
193
"vec2 wrapUv(vec2 uv) {",
143
194
" return fract(uv) * 0.998 + 0.001;",
@@ -158,25 +209,24 @@ const WATER_GROUND_FRAG = [
158
209
" vec2 px = floor(v_texCoord * 16.0) + 0.5;",
159
210
" vec2 puv = px / 16.0;",
160
211
" vec2 world = vec2(u_tileX, u_tileY) + puv;",
161
" float t = u_time;",
162
// Soft body layers (R/G) + crossed caustic vein sprites (B/A).
163
" vec2 uvSoftR = wrapUv(rot2(world * 0.42, 0.35) + vec2(t * 0.39, t * 0.27));",
164
" vec2 uvSoftG = wrapUv(rot2(world * 0.51, -1.05) + vec2(-t * 0.315, t * 0.435));",
165
" vec2 uvCau1 = wrapUv(rot2(world * 0.95, 0.55) + vec2(t * 0.52, -t * 0.28));",
166
" vec2 uvCau2 = wrapUv(rot2(world * 1.15, -1.25) + vec2(-t * 0.41, t * 0.58));",
167
" float softR = texture2D(u_texture, uvSoftR).r;",
168
" float softG = texture2D(u_texture, uvSoftG).g;",
169
" float cau1 = texture2D(u_texture, uvCau1).b;",
170
" float cau2 = texture2D(u_texture, uvCau2).a;",
171
" float soft = softR * 0.55 + softG * 0.45 + softR * softG * 0.25;",
172
" float veins = cau1 * 0.65 + cau2 * 0.65 + cau1 * cau2 * 0.85;",
173
" veins = clamp(veins, 0.0, 1.0);",
174
" float caustic = clamp(soft * 0.55 + veins * 0.75, 0.0, 1.0);",
175
" caustic = pow(caustic, 1.15);",
176
// Glitter: push bright caustic veins to white extremes.
177
" float glitter = pow(max(cau1, cau2), 5.5);",
178
" glitter = max(glitter, pow(cau1 * cau2, 3.2) * 1.35);",
179
" glitter = clamp(glitter, 0.0, 1.0);",
212
" float t = u_time * 0.55;",
213
// Pseudo-normals from offset FBM samples + texture distortion.
214
" float eps = 0.09;",
215
" vec3 base = vec3(world * 0.85, t);",
216
" float nC = fbm(base);",
217
" float nL = fbm(base + vec3(-eps, 0.0, 0.0));",
218
" float nR = fbm(base + vec3(eps, 0.0, 0.0));",
219
" float nD = fbm(base + vec3(0.0, -eps, 0.0));",
220
" float nU = fbm(base + vec3(0.0, eps, 0.0));",
221
" vec2 distort = vec2(nL - nR, nD - nU) * 0.22;",
222
" float texN = texture2D(u_texture, wrapUv(world * 0.28 + distort + vec2(t * 0.03, -t * 0.02))).r;",
223
" float h = nC * 0.85 + (texN - 0.5) * 0.35;",
224
" vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.42));",
225
" float ndotl = clamp(dot(normal, normalize(vec3(0.45, 0.55, 0.7))), 0.0, 1.0);",
226
" float fresnel = pow(1.0 - clamp(normal.z, 0.0, 1.0), 2.4);",
227
" float wave = h * 0.5 + 0.5;",
228
" float glitter = pow(max(0.0, ndotl), 8.0) + pow(fresnel, 3.0) * 0.55;",
229
" glitter = clamp(glitter + pow(max(0.0, wave - 0.62), 2.8) * 0.7, 0.0, 1.0);",
180
230
// Cardinal + diagonal land proximity (inner corners like WWW/WLL).
181
231
" float edgeProx = 0.0;",
182
232
" if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",
@@ -195,20 +245,18 @@ const WATER_GROUND_FRAG = [
195
245
" if (u_edgeSW > 0.5) {",
196
246
" edgeProx = max(edgeProx, smoothstep(0.72, 0.0, length(vec2(puv.x, 1.0 - puv.y))));",
197
247
" }",
198
" float causticBody = caustic * (1.0 - edgeProx * 0.72);",
248
" float waveBody = wave * (1.0 - edgeProx * 0.72);",
199
249
" float glitterBody = glitter * (1.0 - edgeProx * 0.85);",
200
// Continuous shallow↔deep field via corner averages (seamless across tile edges + corners).
201
250
" float deepTop = mix(u_deepNW, u_deepNE, puv.x);",
202
251
" float deepBot = mix(u_deepSW, u_deepSE, puv.x);",
203
252
" float deepMix = mix(deepTop, deepBot, puv.y);",
204
253
" vec3 deepCol = mix(vec3(0.12, 0.36, 0.56), vec3(0.06, 0.18, 0.34), deepMix);",
205
254
" vec3 midCol = mix(vec3(0.22, 0.52, 0.70), vec3(0.12, 0.34, 0.54), deepMix);",
206
255
" vec3 litCol = mix(vec3(0.55, 0.82, 0.94), vec3(0.34, 0.60, 0.82), deepMix);",
207
" vec3 sparkCol = mix(vec3(0.92, 0.98, 1.0), vec3(0.72, 0.88, 0.98), deepMix);",
208
" vec3 rgb = mix(deepCol, midCol, smoothstep(0.12, 0.48, causticBody));",
209
" rgb = mix(rgb, litCol, smoothstep(0.40, 0.88, causticBody));",
256
" vec3 sparkCol = mix(vec3(0.94, 0.99, 1.0), vec3(0.72, 0.88, 0.98), deepMix);",
257
" vec3 rgb = mix(deepCol, midCol, smoothstep(0.28, 0.58, waveBody));",
258
" rgb = mix(rgb, litCol, smoothstep(0.45, 0.88, waveBody) * (0.35 + 0.65 * ndotl));",
210
259
" rgb = mix(rgb, sparkCol, glitterBody * 0.95);",
211
// Darken near land, but stay solid water (no pastel half-blend).
212
260
" rgb = mix(rgb, deepCol, edgeProx * 0.55);",
213
261
" float shoreW = 0.0;",
214
262
" vec3 shoreRgb = rgb;",
@@ -224,8 +272,7 @@ const WATER_GROUND_FRAG = [
224
272
" if (u_edgeE > 0.5) {",
225
273
" sampleShore(1.0, u_shoreEdgeE, vec2(1.0 - puv.x, puv.y), shoreRgb, shoreW);",
226
274
" }",
227
// Binary coast: full shore pixel or full water pixel — never a translucent mix.
228
" float darkAmt = 1.0 - smoothstep(0.18, 0.52, causticBody);",
275
" float darkAmt = 1.0 - smoothstep(0.18, 0.52, waveBody);",
229
276
" float shoreMask = step(0.42, edgeProx * (0.35 + 0.65 * darkAmt)) * shoreW;",
230
277
" rgb = mix(rgb, shoreRgb, shoreMask);",
231
278
" float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",
@@ -115,7 +115,6 @@ const WATER_GROUND_FRAG = [115
"uniform float u_time;",115
"uniform float u_time;",116
"uniform float u_tileX;",116
"uniform float u_tileX;",117
"uniform float u_tileY;",117
"uniform float u_tileY;",118
// Corner deepness (avg of liquid water tiles meeting each corner) — bilinear field.119
"uniform float u_deepNW;",118
"uniform float u_deepNW;",120
"uniform float u_deepNE;",119
"uniform float u_deepNE;",121
"uniform float u_deepSW;",120
"uniform float u_deepSW;",@@ -134,10 +133,62 @@ const WATER_GROUND_FRAG = [134
"uniform float u_shoreEdgeS;",133
"uniform float u_shoreEdgeS;",135
"uniform float u_shoreEdgeW;",134
"uniform float u_shoreEdgeW;",136
"uniform vec4 u_shoreUvRect;",135
"uniform vec4 u_shoreUvRect;",137
"vec2 rot2(vec2 p, float a) {",136
// 3D simplex (Ashima / Gustavson style — OpenSimplex-class continuous field).138
" float c = cos(a);",137
"vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }",139
" float s = sin(a);",138
"vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }",140
" return vec2(c * p.x - s * p.y, s * p.x + c * p.y);",139
"vec4 permute(vec4 x) { return mod289(((x * 34.0) + 1.0) * x); }",140
"vec4 taylorInvSqrt(vec4 r) { return 1.79284291400159 - 0.85373472095314 * r; }",141
"float snoise(vec3 v) {",142
" vec2 C = vec2(1.0 / 6.0, 1.0 / 3.0);",143
" vec4 D = vec4(0.0, 0.5, 1.0, 2.0);",144
" vec3 i = floor(v + dot(v, C.yyy));",145
" vec3 x0 = v - i + dot(i, C.xxx);",146
" vec3 g = step(x0.yzx, x0.xyz);",147
" vec3 l = 1.0 - g;",148
" vec3 i1 = min(g.xyz, l.zxy);",149
" vec3 i2 = max(g.xyz, l.zxy);",150
" vec3 x1 = x0 - i1 + C.xxx;",151
" vec3 x2 = x0 - i2 + C.yyy;",152
" vec3 x3 = x0 - D.yyy;",153
" i = mod289(i);",154
" vec4 p = permute(permute(permute(",155
" i.z + vec4(0.0, i1.z, i2.z, 1.0))",156
" + i.y + vec4(0.0, i1.y, i2.y, 1.0))",157
" + i.x + vec4(0.0, i1.x, i2.x, 1.0));",158
" float n_ = 0.142857142857;",159
" vec3 ns = n_ * D.wyz - D.xzx;",160
" vec4 j = p - 49.0 * floor(p * ns.z * ns.z);",161
" vec4 x_ = floor(j * ns.z);",162
" vec4 y_ = floor(j - 7.0 * x_);",163
" vec4 x = x_ * ns.x + ns.yyyy;",164
" vec4 y = y_ * ns.x + ns.yyyy;",165
" vec4 h = 1.0 - abs(x) - abs(y);",166
" vec4 b0 = vec4(x.xy, y.xy);",167
" vec4 b1 = vec4(x.zw, y.zw);",168
" vec4 s0 = floor(b0) * 2.0 + 1.0;",169
" vec4 s1 = floor(b1) * 2.0 + 1.0;",170
" vec4 sh = -step(h, vec4(0.0));",171
" vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;",172
" vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;",173
" vec3 p0 = vec3(a0.xy, h.x);",174
" vec3 p1 = vec3(a0.zw, h.y);",175
" vec3 p2 = vec3(a1.xy, h.z);",176
" vec3 p3 = vec3(a1.zw, h.w);",177
" vec4 norm = taylorInvSqrt(vec4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));",178
" p0 *= norm.x; p1 *= norm.y; p2 *= norm.z; p3 *= norm.w;",179
" vec4 m = max(0.6 - vec4(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), 0.0);",180
" m = m * m;",181
" return 42.0 * dot(m * m, vec4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));",182
"}",183
// 4-octave FBM: freq ×2, amp ×0.5 each layer; time in Z for continuous ripple.184
"float fbm(vec3 p) {",185
" float sum = 0.0;",186
" float amp = 0.5;",187
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",188
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",189
" sum += amp * snoise(p); p *= 2.0; amp *= 0.5;",190
" sum += amp * snoise(p);",191
" return sum;",141
"}",192
"}",142
"vec2 wrapUv(vec2 uv) {",193
"vec2 wrapUv(vec2 uv) {",143
" return fract(uv) * 0.998 + 0.001;",194
" return fract(uv) * 0.998 + 0.001;",@@ -158,25 +209,24 @@ const WATER_GROUND_FRAG = [158
" vec2 px = floor(v_texCoord * 16.0) + 0.5;",209
" vec2 px = floor(v_texCoord * 16.0) + 0.5;",159
" vec2 puv = px / 16.0;",210
" vec2 puv = px / 16.0;",160
" vec2 world = vec2(u_tileX, u_tileY) + puv;",211
" vec2 world = vec2(u_tileX, u_tileY) + puv;",161
" float t = u_time;",212
" float t = u_time * 0.55;",162
// Soft body layers (R/G) + crossed caustic vein sprites (B/A).213
// Pseudo-normals from offset FBM samples + texture distortion.163
" vec2 uvSoftR = wrapUv(rot2(world * 0.42, 0.35) + vec2(t * 0.39, t * 0.27));",214
" float eps = 0.09;",164
" vec2 uvSoftG = wrapUv(rot2(world * 0.51, -1.05) + vec2(-t * 0.315, t * 0.435));",215
" vec3 base = vec3(world * 0.85, t);",165
" vec2 uvCau1 = wrapUv(rot2(world * 0.95, 0.55) + vec2(t * 0.52, -t * 0.28));",216
" float nC = fbm(base);",166
" vec2 uvCau2 = wrapUv(rot2(world * 1.15, -1.25) + vec2(-t * 0.41, t * 0.58));",217
" float nL = fbm(base + vec3(-eps, 0.0, 0.0));",167
" float softR = texture2D(u_texture, uvSoftR).r;",218
" float nR = fbm(base + vec3(eps, 0.0, 0.0));",168
" float softG = texture2D(u_texture, uvSoftG).g;",219
" float nD = fbm(base + vec3(0.0, -eps, 0.0));",169
" float cau1 = texture2D(u_texture, uvCau1).b;",220
" float nU = fbm(base + vec3(0.0, eps, 0.0));",170
" float cau2 = texture2D(u_texture, uvCau2).a;",221
" vec2 distort = vec2(nL - nR, nD - nU) * 0.22;",171
" float soft = softR * 0.55 + softG * 0.45 + softR * softG * 0.25;",222
" float texN = texture2D(u_texture, wrapUv(world * 0.28 + distort + vec2(t * 0.03, -t * 0.02))).r;",172
" float veins = cau1 * 0.65 + cau2 * 0.65 + cau1 * cau2 * 0.85;",223
" float h = nC * 0.85 + (texN - 0.5) * 0.35;",173
" veins = clamp(veins, 0.0, 1.0);",224
" vec3 normal = normalize(vec3(nL - nR, nD - nU, 0.42));",174
" float caustic = clamp(soft * 0.55 + veins * 0.75, 0.0, 1.0);",225
" float ndotl = clamp(dot(normal, normalize(vec3(0.45, 0.55, 0.7))), 0.0, 1.0);",175
" caustic = pow(caustic, 1.15);",226
" float fresnel = pow(1.0 - clamp(normal.z, 0.0, 1.0), 2.4);",176
// Glitter: push bright caustic veins to white extremes.227
" float wave = h * 0.5 + 0.5;",177
" float glitter = pow(max(cau1, cau2), 5.5);",228
" float glitter = pow(max(0.0, ndotl), 8.0) + pow(fresnel, 3.0) * 0.55;",178
" glitter = max(glitter, pow(cau1 * cau2, 3.2) * 1.35);",229
" glitter = clamp(glitter + pow(max(0.0, wave - 0.62), 2.8) * 0.7, 0.0, 1.0);",179
" glitter = clamp(glitter, 0.0, 1.0);",180
// Cardinal + diagonal land proximity (inner corners like WWW/WLL).230
// Cardinal + diagonal land proximity (inner corners like WWW/WLL).181
" float edgeProx = 0.0;",231
" float edgeProx = 0.0;",182
" if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",232
" if (u_edgeN > 0.5) { edgeProx = max(edgeProx, smoothstep(0.55, 0.0, puv.y)); }",@@ -195,20 +245,18 @@ const WATER_GROUND_FRAG = [195
" if (u_edgeSW > 0.5) {",245
" if (u_edgeSW > 0.5) {",196
" edgeProx = max(edgeProx, smoothstep(0.72, 0.0, length(vec2(puv.x, 1.0 - puv.y))));",246
" edgeProx = max(edgeProx, smoothstep(0.72, 0.0, length(vec2(puv.x, 1.0 - puv.y))));",197
" }",247
" }",198
" float causticBody = caustic * (1.0 - edgeProx * 0.72);",248
" float waveBody = wave * (1.0 - edgeProx * 0.72);",199
" float glitterBody = glitter * (1.0 - edgeProx * 0.85);",249
" float glitterBody = glitter * (1.0 - edgeProx * 0.85);",200
// Continuous shallow↔deep field via corner averages (seamless across tile edges + corners).201
" float deepTop = mix(u_deepNW, u_deepNE, puv.x);",250
" float deepTop = mix(u_deepNW, u_deepNE, puv.x);",202
" float deepBot = mix(u_deepSW, u_deepSE, puv.x);",251
" float deepBot = mix(u_deepSW, u_deepSE, puv.x);",203
" float deepMix = mix(deepTop, deepBot, puv.y);",252
" float deepMix = mix(deepTop, deepBot, puv.y);",204
" vec3 deepCol = mix(vec3(0.12, 0.36, 0.56), vec3(0.06, 0.18, 0.34), deepMix);",253
" vec3 deepCol = mix(vec3(0.12, 0.36, 0.56), vec3(0.06, 0.18, 0.34), deepMix);",205
" vec3 midCol = mix(vec3(0.22, 0.52, 0.70), vec3(0.12, 0.34, 0.54), deepMix);",254
" vec3 midCol = mix(vec3(0.22, 0.52, 0.70), vec3(0.12, 0.34, 0.54), deepMix);",206
" vec3 litCol = mix(vec3(0.55, 0.82, 0.94), vec3(0.34, 0.60, 0.82), deepMix);",255
" vec3 litCol = mix(vec3(0.55, 0.82, 0.94), vec3(0.34, 0.60, 0.82), deepMix);",207
" vec3 sparkCol = mix(vec3(0.92, 0.98, 1.0), vec3(0.72, 0.88, 0.98), deepMix);",256
" vec3 sparkCol = mix(vec3(0.94, 0.99, 1.0), vec3(0.72, 0.88, 0.98), deepMix);",208
" vec3 rgb = mix(deepCol, midCol, smoothstep(0.12, 0.48, causticBody));",257
" vec3 rgb = mix(deepCol, midCol, smoothstep(0.28, 0.58, waveBody));",209
" rgb = mix(rgb, litCol, smoothstep(0.40, 0.88, causticBody));",258
" rgb = mix(rgb, litCol, smoothstep(0.45, 0.88, waveBody) * (0.35 + 0.65 * ndotl));",210
" rgb = mix(rgb, sparkCol, glitterBody * 0.95);",259
" rgb = mix(rgb, sparkCol, glitterBody * 0.95);",211
// Darken near land, but stay solid water (no pastel half-blend).212
" rgb = mix(rgb, deepCol, edgeProx * 0.55);",260
" rgb = mix(rgb, deepCol, edgeProx * 0.55);",213
" float shoreW = 0.0;",261
" float shoreW = 0.0;",214
" vec3 shoreRgb = rgb;",262
" vec3 shoreRgb = rgb;",@@ -224,8 +272,7 @@ const WATER_GROUND_FRAG = [224
" if (u_edgeE > 0.5) {",272
" if (u_edgeE > 0.5) {",225
" sampleShore(1.0, u_shoreEdgeE, vec2(1.0 - puv.x, puv.y), shoreRgb, shoreW);",273
" sampleShore(1.0, u_shoreEdgeE, vec2(1.0 - puv.x, puv.y), shoreRgb, shoreW);",226
" }",274
" }",227
// Binary coast: full shore pixel or full water pixel — never a translucent mix.275
" float darkAmt = 1.0 - smoothstep(0.18, 0.52, waveBody);",228
" float darkAmt = 1.0 - smoothstep(0.18, 0.52, causticBody);",229
" float shoreMask = step(0.42, edgeProx * (0.35 + 0.65 * darkAmt)) * shoreW;",276
" float shoreMask = step(0.42, edgeProx * (0.35 + 0.65 * darkAmt)) * shoreW;",230
" rgb = mix(rgb, shoreRgb, shoreMask);",277
" rgb = mix(rgb, shoreRgb, shoreMask);",231
" float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",278
" float litTop = mix(u_litNW, u_litNE, v_texCoord.x);",