mapspinner 0.1.61 → 0.1.62

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.61",
3
+ "version": "0.1.62",
4
4
  "description": "WebGL2 Earth-scale terrain rendering SDK for interactive globe applications",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -1877,38 +1877,26 @@ void main() {
1877
1877
  wt += vTexWarp * uTexWarp;
1878
1878
  vec3 tw = abs(n); tw = tw * tw; tw /= (tw.x + tw.y + tw.z + 1e-4);
1879
1879
  const vec3 LUMA = vec3(0.299, 0.587, 0.114);
1880
- float detailFade = (1.0 - smoothstep(1.0, 12.0, pxWorld));
1881
1880
  float bAB = clamp(wA / max(wA + wB, 1e-4), 0.0, 1.0);
1882
- // PER-LAYER material = base octave (NORMALS ONLY -> albedo flattened to luma, macro color carries
1883
- // chroma) + the 4x DETAIL octave (albedo STRUCTURE + strong normal) + a per-layer DISPLACEMENT
1884
- // (coarse base, refined by the 4x near the deck). Each top-2 layer is built FULLY here, then the
1885
- // two are HEIGHT-BLENDED (below) -- so the detail never flips at the boundary (the 'hard lines up
1886
- // close ever since the higher octave' bug = the detail used the dominant layer only).
1887
- vec4 albA = surfTriTap(uSurfAlb, wt, tw, lA);
1888
- vec3 cA = vec3(dot(albA.rgb, LUMA)); vec3 nA = surfTriNrm(uSurfNrm, wt, tw, lA, n); float dispA = albA.a;
1889
- if (detailFade > 0.01) {
1890
- vec4 dA = surfTriTap(uSurfAlb, wt * 4.0, tw, lA);
1891
- cA *= mix(1.0, clamp(dot(dA.rgb, LUMA) / max(dot(cA, LUMA), 0.04), 0.35, 2.4), detailFade * 1.3);
1892
- nA += surfTriNrm(uSurfNrm, wt * 4.0, tw, lA, n) * detailFade * 1.4;
1893
- dispA = mix(dispA, dA.a, detailFade); // fine displacement poke near the deck
1894
- }
1881
+ // SINGLE HIGH-FREQUENCY OCTAVE + MIPS (user 2026-06-14 'instead of swapping out texture octaves,
1882
+ // just use the highest one and let it mip and get rid of the fade-in'): sample the material at the
1883
+ // FINE scale (wt*4, ~0.6m/texel) at EVERY distance and let the GPU mip chain average it down far
1884
+ // off (= the old low-freq look) -- no second octave, no detailFade. Albedo = luma STRUCTURE (macro
1885
+ // color carries chroma); normal strong (x1.4); displacement drives the height-blend (mips soften
1886
+ // the displacement, and thus the blend, at distance automatically).
1887
+ highp vec3 wt4 = wt * 4.0;
1888
+ vec4 albA = surfTriTap(uSurfAlb, wt4, tw, lA);
1889
+ vec3 cA = vec3(dot(albA.rgb, LUMA)); vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4; float dispA = albA.a;
1895
1890
  vec4 texAlb = vec4(cA, dispA); vec3 texNrm = nA;
1891
+ float splatRock = (abs(lA - 1.0) < 0.5) ? 1.0 : 0.0; // height-blend rock fraction (layer 1 = rock)
1896
1892
  if (wB > 0.02) { // second layer only where a real transition exists
1897
- vec4 albB = surfTriTap(uSurfAlb, wt, tw, lB);
1898
- vec3 cB = vec3(dot(albB.rgb, LUMA)); vec3 nB = surfTriNrm(uSurfNrm, wt, tw, lB, n); float dispB = albB.a;
1899
- if (detailFade > 0.01) {
1900
- vec4 dB = surfTriTap(uSurfAlb, wt * 4.0, tw, lB);
1901
- cB *= mix(1.0, clamp(dot(dB.rgb, LUMA) / max(dot(cB, LUMA), 0.04), 0.35, 2.4), detailFade * 1.3);
1902
- nB += surfTriNrm(uSurfNrm, wt * 4.0, tw, lB, n) * detailFade * 1.4;
1903
- dispB = mix(dispB, dB.a, detailFade);
1904
- }
1905
- // HEIGHT-BLEND POKE-THROUGH (user 2026-06-14 'each texture's higher areas should poke through
1906
- // the other, offset by the ramp'): each layer's height = its DISPLACEMENT + a weight-ramp
1907
- // offset (so the gate still positions the boundary). The higher height wins, blended over a
1908
- // soft WIDTH so the loser's high bumps still poke through near the ramp -> interlocking
1909
- // fingers, never a hard line. This is the ONE blend for ALL pairs (slope-rock, height-snow,
1910
- // climate/area-biome, beach). bw widens close-up (where the detail is rich) for a softer mesh.
1911
- float bw = mix(0.12, 0.30, detailFade);
1893
+ vec4 albB = surfTriTap(uSurfAlb, wt4, tw, lB);
1894
+ vec3 cB = vec3(dot(albB.rgb, LUMA)); vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 1.4; float dispB = albB.a;
1895
+ // HEIGHT-BLEND POKE-THROUGH (user 'each texture's higher areas should poke through the other,
1896
+ // offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
1897
+ // boundary); higher wins over a soft width so the loser's high bumps poke through = fingers,
1898
+ // no hard line. ONE blend for ALL pairs. Mips smooth dispA/dispB at distance -> soft far edge.
1899
+ float bw = 0.25;
1912
1900
  float hA = dispA + (bAB - 0.5) * 1.1;
1913
1901
  float hB = dispB + (0.5 - bAB) * 1.1;
1914
1902
  float mh = max(hA, hB) - bw;
@@ -1916,7 +1904,14 @@ void main() {
1916
1904
  float bSharp = waH / max(waH + wbH, 1e-4);
1917
1905
  texAlb = vec4(mix(cB, cA, bSharp), mix(dispB, dispA, bSharp));
1918
1906
  texNrm = mix(nB, nA, bSharp);
1907
+ splatRock = (abs(lA - 1.0) < 0.5 ? bSharp : 0.0) + (abs(lB - 1.0) < 0.5 ? (1.0 - bSharp) : 0.0);
1919
1908
  }
1909
+ // MATCH COLOR TO NORMAL (user 2026-06-14 'green grassy patches with the rock normals -- should be
1910
+ // rock colored or grass normals'): texNrm follows the displacement height-blend (rock on bumps in
1911
+ // the slope-transition band) but the macro albedo used the slope gate -> grass color under a rock
1912
+ // normal. Push the macro color toward bcRock by the splat's actual rock fraction so the COLOR
1913
+ // follows the same selection the NORMAL does (bounded -- splatRock is 0 where rock isn't in top-2).
1914
+ albedo = mix(albedo, bcRock, splatRock * 0.8);
1920
1915
  float k = uTexMix * texFarFade;
1921
1916
  // macro-tinted detail (user 2026-06-10 'the textured patch must be tinted to the same shade
1922
1917
  // as the spot its replacing'): the texture contributes STRUCTURE + relative chroma only,
@@ -37,7 +37,7 @@ const DEFAULTS = {
37
37
  bcLowland: [0.20,0.34,0.15], bcGrass: [0.26,0.40,0.17], bcRock: [0.52,0.43,0.34], // bcRock -> a clearly WARMER TAN-GREY (R>G>B) so it reads as ROCK when lit, not olive-green (the [0.46,0.42,0.37] near-grey read green next to the biome). state.biome OVERRIDES gl-render defaults via window.__gen.
38
38
  bcSnow: [0.92,0.94,0.97],
39
39
  bandEdgesLo: [150.0,1200.0], bandEdgesHi: [3500.0,6500.0], snowEdges: [6000.0,8500.0], // 8000/10500->6000/8500 (user 2026-06-11 'snowy mountains disappeared' -- see gl-render snowEdges note) // snowEdges 5200/7000->8000/10500 (user 2026-06-10 'entire terrain white': the rock-by-height fix unmasked snow gates tuned pre-4x; full snow from 5.2km whitened the 11.6km massifs; coldSnow onset = snowEdges.x*0.5 follows) // bandEdgesHi 1600/3200->3500/6500 (user 2026-06-10 'rockface everywhere'): tuned on the pre-4x terrain; with 11.6km peaks everything above 3200m read rock BY HEIGHT alone -- rescale the treeline to the new elevation range
40
- seaDepthM: 3000.0, slopeRock: [0.0,0.22], // hi 0.3->0.22 (user 2026-06-14 'rock face angle more sensitive, gentler slopes turn to rock'): rock fully engages by ~0.22 slope; lo stays 0.0 so truly-flat (rockSlope~0) keeps grass
40
+ seaDepthM: 3000.0, slopeRock: [-0.0,0.4], // [-0.0,0.4] USER-SET 2026-06-14 (wider rock-slope band)
41
41
  },
42
42
  // REAL-WORLD LOOK overhaul (terraformable lighting/shading levers; applyShaderGlobals sets window
43
43
  // globals; gl-render reads them via _g()). Beer-Lambert ocean, biome sat, mottle, sky-fill relief,