mapspinner 0.1.64 → 0.1.66

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.64",
3
+ "version": "0.1.66",
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
@@ -787,7 +787,7 @@ export async function initMapspinnerRender(gl, opts = {}) {
787
787
  // out fall beyond the far plane and vanish. Dropping the horizon reference radius 500m below sea level
788
788
  // extends the horizon to tens of km at low altitude so near-shore relief stays in view (negligible
789
789
  // depth-precision cost: 500m vs R~6.37e6). Both the cull and the draw use this (single source).
790
- const RHORIZON = R - 250.0; // far brought in 500->250 (user 2026-06-14 'bring far plane in a bit'): deck horizon ~80km->~56km = more z-precision; still clears coastal mountains
790
+ const RHORIZON = R - 150.0; // far brought in 500->250 (user 2026-06-14 'bring far plane in a bit'): deck horizon ~80km->~56km = more z-precision; still clears coastal mountains
791
791
  // UNDERWATER FAR-PLANE FIX (user 2026-06-14 'at -214m visible, at -500m it disappears'): when the
792
792
  // camera is more than 500m below sea level, camDist < RHORIZON so the sea-level horizon is imaginary
793
793
  // (-> 0) and alt is negative; the old max(horizon, alt*8) then collapsed the far plane to ~0 and the
@@ -797,7 +797,7 @@ export async function initMapspinnerRender(gl, opts = {}) {
797
797
  // MATCH render()'s near exactly (2026-06-14 jank fix): the cull frustum must use the SAME near
798
798
  // as the draw frustum, else behind-limb/screen-AABB culling diverges from what is actually drawn
799
799
  // at the deck (cull near was max(*0.1,0.1) while render used the <2m 0.05 branch).
800
- const near = altAboveTerrain < 2.0 ? 0.25 : Math.max(altAboveTerrain * 0.1, 0.25); // near nudged out 0.05->0.25 (user 2026-06-14 'improve on-ground'): more z-precision on the deck
800
+ const near = altAboveTerrain < 2.0 ? 0.5 : Math.max(altAboveTerrain * 0.1, 0.5); // near nudged out 0.05->0.25 (user 2026-06-14 'improve on-ground'): more z-precision on the deck
801
801
  // FAR PLANE: horizon distance tracks the visible ground edge; blends toward camDist
802
802
  // above 500km for orbital views so the full planet is visible.
803
803
  const _fBlend = Math.min(1.0, Math.max(0.0, (alt - 500000.0) / 4500000.0));
@@ -835,14 +835,14 @@ export async function initMapspinnerRender(gl, opts = {}) {
835
835
  // out fall beyond the far plane and vanish. Dropping the horizon reference radius 500m below sea level
836
836
  // extends the horizon to tens of km at low altitude so near-shore relief stays in view (negligible
837
837
  // depth-precision cost: 500m vs R~6.37e6). Both the cull and the draw use this (single source).
838
- const RHORIZON = R - 250.0; // far brought in 500->250 (user 2026-06-14 'bring far plane in a bit'): deck horizon ~80km->~56km = more z-precision; still clears coastal mountains
838
+ const RHORIZON = R - 150.0; // far brought in 500->250 (user 2026-06-14 'bring far plane in a bit'): deck horizon ~80km->~56km = more z-precision; still clears coastal mountains
839
839
  // UNDERWATER FAR-PLANE FIX (user 2026-06-14 'at -214m visible, at -500m it disappears'): when the
840
840
  // camera is more than 500m below sea level, camDist < RHORIZON so the sea-level horizon is imaginary
841
841
  // (-> 0) and alt is negative; the old max(horizon, alt*8) then collapsed the far plane to ~0 and the
842
842
  // whole scene vanished past -500m deep (= the 'ocean looks shallow/empty' when exploring). Floor the
843
843
  // far reach to 60km when submerged so the seabed + the underwater view stay visible.
844
844
  const horizon = (camDist > RHORIZON) ? Math.sqrt(camDist*camDist - RHORIZON*RHORIZON) : 60000.0;
845
- const near = altAboveTerrain < 2.0 ? 0.25 : Math.max(altAboveTerrain * 0.1, 0.25); // near nudged out 0.05->0.25 (user 2026-06-14 'improve on-ground'): more z-precision on the deck
845
+ const near = altAboveTerrain < 2.0 ? 0.5 : Math.max(altAboveTerrain * 0.1, 0.5); // near nudged out 0.05->0.25 (user 2026-06-14 'improve on-ground'): more z-precision on the deck
846
846
  const _fBlend = Math.min(1.0, Math.max(0.0, (alt - 500000.0) / 4500000.0));
847
847
  const farGround = Math.max(horizon, alt * 8.0);
848
848
  const far = farGround * (1.0 - _fBlend) + camDist * _fBlend;
@@ -1807,9 +1807,13 @@ void main() {
1807
1807
  // NOT a fractal (user 2026-06-14: 'looking like a fractal, use the materials displacement'). Widen
1808
1808
  // the gate transition band so sand+grass overlap over a broad elevation span -> bSharp picks the
1809
1809
  // local winner by texture relief -> fingered shoreline that follows the actual texture bumps.
1810
+ // MUCH MORE GRADUAL grass<->sand margin (user 2026-06-14): the WEIGHT crosses over slowly across
1811
+ // a wide elevation span (0 -> ~2.5x beachTop); the per-pixel transition is then made HARD by the
1812
+ // displacement height-blend (small bw below) so sand vs grass is a sharp choice distributed by
1813
+ // texture relief = interlocking fingers that thin out with height, never a blendy fade.
1810
1814
  float beachW = warpN * uBeachTopM * 0.30; // warp amplitude scales with the beach band height
1811
- float beach = (1.0 - smoothstep(uBeachTopM * 0.10 + beachW, uBeachTopM * 1.15 + beachW, vH))
1812
- * (1.0 - smoothstep(0.15, 0.42, slope));
1815
+ float beach = (1.0 - smoothstep(beachW, uBeachTopM * 2.5 + beachW, vH))
1816
+ * (1.0 - smoothstep(0.18, 0.55, slope));
1813
1817
  // SAND BLEED (2026-06-13): patchy sand spills above the main beach line, modulated by VS
1814
1818
  // warp noise so the edge reads as wind-blown pockets, not a strict elevation cut. At peak it
1815
1819
  // adds ~0.3 sand weight far above the beach, creating a natural dappled transition.
@@ -1912,7 +1916,7 @@ void main() {
1912
1916
  // offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
1913
1917
  // boundary); higher wins over a soft width so the loser's high bumps poke through = fingers,
1914
1918
  // no hard line. ONE blend for ALL pairs. Mips smooth dispA/dispB at distance -> soft far edge.
1915
- float bw = 0.25;
1919
+ float bw = 0.06; // NEAR-HARD crossover (user 2026-06-14 'make the transition hard, let the displacement make the distribution interesting -> far less blendy'): the displacement picks a sharp per-pixel winner; the gate weight only shifts the proportion across the ramp
1916
1920
  float hA = dispA + (bAB - 0.5) * 1.1;
1917
1921
  float hB = dispB + (0.5 - bAB) * 1.1;
1918
1922
  float mh = max(hA, hB) - bw;