mapspinner 0.1.54 → 0.1.56

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.54",
3
+ "version": "0.1.56",
4
4
  "description": "WebGL2 Earth-scale terrain rendering SDK for interactive globe applications",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -143,7 +143,7 @@ float snoise3(highp vec3 P){ highp vec3 i=floor(P),f=fract(P); highp vec3 u=f*f*
143
143
  // the same class as the historical snoise3-in-VS-only bug). Pure fn of world dir -> seam-safe +
144
144
  // LOD-invariant. Each has an EROSION profile: a wide graded shoulder/valley/bench that blends into
145
145
  // terrain plus a deeper core, and returns a wet/depth mask the FS colours.
146
- const float LAKE_CARVE_DEPTH = 90.0; // metres of bowl depth at basin centre
146
+ const float LAKE_CARVE_DEPTH = 220.0; // 90->220 metres of bowl depth (user 2026-06-14 'lakes super shallow+flat'): deeper basins
147
147
  float lakeBasinField(vec3 dir){ return 0.5 + 0.5 * snoise3(dir * 55.0 + vec3(4.0, 9.0, 1.0)); }
148
148
  float lakeCarveM(vec3 dir, out float wet){
149
149
  float basin = lakeBasinField(dir);
@@ -186,7 +186,7 @@ float inciseRidgeField(vec3 d, float baseFreq, float freqMul){
186
186
  }
187
187
  return sum / norm; // ->1 on the channel network
188
188
  }
189
- const float RIVER_INCISE_DEPTH = 120.0; // metres at the channel thalweg
189
+ const float RIVER_INCISE_DEPTH = 280.0; // 120->280 metres at the channel thalweg (user 2026-06-14 'rivers/channels super shallow+flat'): deeper incision
190
190
  float riverRidgeField(vec3 dir){ return inciseRidgeField(normalize(dir), 40.0, 2.03); }
191
191
  float riverCarveM(vec3 dir, out float wet){
192
192
  float ridge = riverRidgeField(dir);
@@ -631,14 +631,16 @@ highp float composeHeight(vec3 dir0, highp vec2 faceLocal, float tileM){ // W7
631
631
  // whole ocean into 'almost-land everywhere', user 2026-06-14) with the flat-at-waterline curve so
632
632
  // both sides meet the waterline at slope 0 (no crease); beyond SEABED_EASE the true bathymetry
633
633
  // resumes so the ocean goes DEEP.
634
- const highp float SEABED_EASE = 120.0; // metres of depth flattened at the shore (decoupled from the land beach)
634
+ const highp float SEABED_EASE = 25.0; // metres of depth flattened at the shore (decoupled from the land beach)
635
635
  highp float d0 = -h;
636
636
  highp float d = (d0 < SEABED_EASE) ? (d0 * d0 / SEABED_EASE) * (2.0 - d0 / SEABED_EASE) : d0;
637
- // STEEPER DROP-OFF (user 2026-06-14 'seabed flat/close to waterline; steeper + more relief'):
638
- // narrow shelf 500->150m raw, steeper shelf 0.24->0.6, steeper continental slope 1.19->1.5 so the
637
+ // NO 'SECOND BEACH' (user 2026-06-14 'shallow ring of water around land / making a second beach'):
638
+ // the wide flat shelf read as a shallow underwater beach ring. Shelf cut to a tiny 25m-raw lip then
639
+ // a STEEP 1.9 plunge so the water drops to real depth immediately off the actual beach -- no shelf.
640
+ // (former: narrow shelf 500->150m raw, steeper shelf 0.24->0.6, steeper continental slope 1.19->1.5 so the
639
641
  // seabed plunges to deep water just offshore (less flat shallow shelf) and the deep bathymetry
640
642
  // carries 1.5x the bShape relief = more dramatic underwater terrain to explore.
641
- h = -(min(d, 150.0) * 0.6 + max(d - 150.0, 0.0) * 1.5);
643
+ h = -(min(d, 25.0) * 0.4 + max(d - 25.0, 0.0) * 1.9);
642
644
  h = max(h, -11000.0); // cap depth at Mariana Trench (~11km)
643
645
  } else {
644
646
  // LAND COASTAL SHELF (user 2026-06-14: 'beaches not wide enough'): the underwater shelf above
@@ -869,10 +871,10 @@ void main() {
869
871
  // shelf/slope bathymetry remap + underwater displacement -- MUST mirror composeHeight exactly
870
872
  // (this is the FS-material running value; composeHeight is the geometry/probe height).
871
873
  if (vH < 0.0) {
872
- const highp float SEABED_EASE = 120.0; // mirror composeHeight: narrow waterline ease, deep ocean beyond
874
+ const highp float SEABED_EASE = 25.0; // mirror composeHeight: tiny waterline lip, steep plunge (no 'second beach')
873
875
  highp float dSea0 = -vH;
874
876
  highp float dSea = (dSea0 < SEABED_EASE) ? (dSea0 * dSea0 / SEABED_EASE) * (2.0 - dSea0 / SEABED_EASE) : dSea0;
875
- vH = -(min(dSea, 150.0) * 0.6 + max(dSea - 150.0, 0.0) * 1.5); // steeper drop-off (mirror composeHeight)
877
+ vH = -(min(dSea, 25.0) * 0.4 + max(dSea - 25.0, 0.0) * 1.9); // steep drop-off (mirror composeHeight)
876
878
  vH = max(vH, -11000.0); // cap depth at Mariana Trench (~11km)
877
879
  } else {
878
880
  highp float bShelf = uBeachShelfM > 1.0 ? uBeachShelfM : 600.0; // LAND COASTAL SHELF -- mirror composeHeight exactly (wide beach, user 2026-06-14); guard stale/unset uniform
@@ -1879,6 +1881,23 @@ void main() {
1879
1881
  texAlb = mix(albB, albA, bSharp);
1880
1882
  texNrm = mix(nrmB, nrmA, bSharp);
1881
1883
  }
1884
+ // FINE DETAIL OCTAVE (user 2026-06-14 'add one octave at 4x smaller -> world better scaled at
1885
+ // 2m'): the base photo tiles at uTexTileM (~2.4km = ~2.3m/texel, smeared at the deck). Sample the
1886
+ // SAME dominant material at 4x frequency (~0.6m/texel) and overlay its luminance + normal so
1887
+ // close-up the ground gains sub-metre structure. Faded out by ~12m px so it never moires far off.
1888
+ float detailFade = (1.0 - smoothstep(1.0, 12.0, pxWorld));
1889
+ if (detailFade > 0.01) {
1890
+ vec4 dA = surfTriTap(uSurfAlb, wt * 4.0, tw, lA);
1891
+ float dl = dot(dA.rgb, vec3(0.299, 0.587, 0.114));
1892
+ float bl = dot(texAlb.rgb, vec3(0.299, 0.587, 0.114));
1893
+ texAlb.rgb *= mix(1.0, clamp(dl / max(bl, 0.04), 0.55, 1.7), detailFade * 0.6);
1894
+ // detail NORMAL: surfTriNrm returns a PERTURBATION vector (texNrm feeds texDn = texNrm*uTexNrmK*k
1895
+ // at the apply site, NOT a unit normal), so the detail is simply ADDED in the same space -- no
1896
+ // normalize (normalizing the perturbation scrambled its magnitude = the 'weird highest-octave
1897
+ // normals'). Half-weight so the fine octave textures relief without overpowering the base.
1898
+ vec3 dN = surfTriNrm(uSurfNrm, wt * 4.0, tw, lA, n);
1899
+ texNrm = texNrm + dN * detailFade * 0.5;
1900
+ }
1882
1901
  float k = uTexMix * texFarFade;
1883
1902
  // macro-tinted detail (user 2026-06-10 'the textured patch must be tinted to the same shade
1884
1903
  // as the spot its replacing'): the texture contributes STRUCTURE + relative chroma only,
@@ -2220,8 +2239,10 @@ void main() {
2220
2239
  // bypasses it via vH<0). Gating on vWaterDepth (NOT the whole carve mask) makes the water LINE UP
2221
2240
  // with the flat carved surface -- the graded erosion banks above the waterline stay dry land.
2222
2241
  if (vH >= 0.0 && vWaterDepth > 0.0) {
2223
- // submergence 0..1 over ~0..40m -> shoreline (thin water, terrain shows through) to deep.
2224
- float sub = clamp(vWaterDepth / 40.0, 0.0, 1.0);
2242
+ // submergence 0..1 over ~0..160m (40->160, user 2026-06-14 'water super shallow+flat'): the color
2243
+ // saturated at 40m so every deeper lake/river read one flat tone; stretch it so depth shows as a
2244
+ // shallow-edge -> deep-center gradient (thin transparent rim, deep dark center).
2245
+ float sub = clamp(vWaterDepth / 160.0, 0.0, 1.0);
2225
2246
  // wave-perturbed water normal (small inland ripple), same tangent frame as the ground.
2226
2247
  highp vec3 wOriginL = floor(camWorld / 1024.0) * 1024.0; // W7: ~6.4e6 m snapped anchor -> highp
2227
2248
  highp vec2 wpL = vec2(dot(vWorld - wOriginL, ux), dot(vWorld - wOriginL, uy)); // W7: highp camera-relative wave coord
@@ -46,7 +46,7 @@ const DEFAULTS = {
46
46
  exposure: 1.0, skyFill: 0.45, biomeSat: 0.72, variationAmt: 0.04, colorVar: 0.5, vertexAO: 1.0, reliefShade: 2.5, // variationAmt 0.08->0.04 (user 2026-06-10 'blotchy': the ~50km value mottle painted light/dark patches across the massifs)
47
47
  nightFloor: 0.16, termWidth: 0.25, terminatorGlow: 0.30, lookSat: 1.15, lookContrast: 1.08, // nightFloor 0.05->0.16: no black night terrain (2026-06-09)
48
48
  detailOverlay: 6.0, hazeMul: 0.65, // 2026-06-10 'pale hazy + featureless': perlin-everywhere albedo+elevation fbm (user-tuned 6) + aerial-perspective strength cut
49
- ocean: { deep: [0.008,0.025,0.06], shallow: [0.07,0.22,0.26], k: [0.016,0.007,0.0028] }, // k halved (user 2026-06-14 'see the land under the water'): clearer water, bed visible through shallow/medium depth. OVERRIDES the gl-render uOceanK default via window.__uOceanK.
49
+ ocean: { deep: [0.008,0.025,0.06], shallow: [0.07,0.22,0.26], k: [0.009,0.004,0.0018] }, // k lowered again (user 2026-06-14 'water properly transparent so we see the surface under it'): clearer, the seabed shows through shallow/medium water; deep basins still opaque. OVERRIDES gl-render via window.__uOceanK.
50
50
  },
51
51
  // HPF band scales (multipliers on the anchor-field band base values; anchor-field.setBandScales).
52
52
  hpf: {