mapspinner 0.1.43 → 0.1.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mapspinner",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "WebGL2 Earth-scale terrain rendering SDK for interactive globe applications",
5
5
  "main": "src/index.js",
6
6
  "exports": {
package/src/gl-render.js CHANGED
@@ -1109,7 +1109,12 @@ export async function initMapspinnerRender(gl, opts = {}) {
1109
1109
  // seabed, so the depth test culled the water across entire shorelines. Level-9 cells
1110
1110
  // (~1.6km) sag ~5cm, far under any visible bathymetry, still ~16-64x fewer water verts
1111
1111
  // than the deep terrain leaves.
1112
- const WCAP = 9;
1112
+ // WCAP 9 -> 11 (user 2026-06-14 'water lines still jagged and square, doesnt meet land properly'):
1113
+ // the water-pass `if(vH>1.0) discard` keys off the water mesh's COARSE interpolated seabed height,
1114
+ // so the discarded waterline stepped at ~1.6km (level-9) cells = square/jagged edges that didn't
1115
+ // follow the fine seabed coastline. Level-11 cells (~400m) -> ~4x finer waterline. Water-vertex
1116
+ // cost rises (watch FPS); still far fewer verts than the full-LOD terrain leaves.
1117
+ const WCAP = 11;
1113
1118
  // OWN persistent buffer (instBufWater) + static-frame skip: on an unchanged quad set, reuse the
1114
1119
  // cached water instances (skip the dedup Set-loop + Float32Array + bufferData). Separate buffer
1115
1120
  // means the terrain pass never clobbers it (the prior water-as-terrain regression root).
@@ -1579,8 +1579,13 @@ void main() {
1579
1579
  mappedW = clamp((mappedW - 0.5) * uLookContrast + 0.5, 0.0, 1.0);
1580
1580
  // coverage: optically thick water -> opaque; first metres see-through; grazing fresnel and
1581
1581
  // foam are opaque regardless of depth; feather the exact waterline contact.
1582
+ // THIN WATER STAYS CLEAR (user 2026-06-14 'water isnt transparent where its thin'): the grazing
1583
+ // fresnel forced shallow water OPAQUE even looking across a shoreline. Gate fresnel opacity by a
1584
+ // depth ramp so thin water shows the bed regardless of view angle; foam + Beer-Lambert depth
1585
+ // opacity stay so deep/foamy water still reads solid.
1586
+ float shallowClear = smoothstep(0.0, 6.0, depthM); // 0 in thin water -> clear; 1 by ~6m -> full fresnel
1582
1587
  float alphaW = clamp(1.0 - Tavg, 0.0, 1.0);
1583
- alphaW = max(alphaW, fres * 0.9);
1588
+ alphaW = max(alphaW, fres * 0.9 * shallowClear);
1584
1589
  alphaW = max(alphaW, foamAmt * 0.8);
1585
1590
  // SHALLOW-SURFACE FLOOR (2026-06-11, found by the coast witness after the shelf landed):
1586
1591
  // the continental shelf keeps water metres-deep for kilometres, where Beer-Lambert alpha