mapspinner 0.1.67 → 0.1.68

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.67",
3
+ "version": "0.1.68",
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
@@ -1051,7 +1051,7 @@ export async function initMapspinnerRender(gl, opts = {}) {
1051
1051
  gl.uniform1f(U('oceanAmp'), (oc.oceanAmplitude != null) ? oc.oceanAmplitude : 1.0);
1052
1052
  gl.uniform1f(U('oceanChoppy'), (oc.oceanChoppiness != null) ? oc.oceanChoppiness : 0.5);
1053
1053
  gl.uniform1f(U('oceanFoam'), (oc.oceanFoam != null) ? oc.oceanFoam : 0.5);
1054
- gl.uniform1f(U('uBeachTopM'), _g('beachTop', 80.0)); // beach ceiling: grass stops, sand to the waterline + under it. 30->90 (user 2026-06-14: 3x beach width)
1054
+ gl.uniform1f(U('uBeachTopM'), _g('beachTop', 640.0)); // beach ceiling: grass stops, sand to the waterline + under it. 30->90 (user 2026-06-14: 3x beach width)
1055
1055
 
1056
1056
  // SINGLE INSTANCED DRAW: the deform params that were per-quad uniforms (ox,oy,l,level + face)
1057
1057
  // are now PER-INSTANCE attributes. Build one interleaved instance buffer [ox,oy,l,level,face]
@@ -1812,7 +1812,7 @@ void main() {
1812
1812
  // displacement height-blend (small bw below) so sand vs grass is a sharp choice distributed by
1813
1813
  // texture relief = interlocking fingers that thin out with height, never a blendy fade.
1814
1814
  float beachW = warpN * uBeachTopM * 0.30; // warp amplitude scales with the beach band height
1815
- float beach = (1.0 - smoothstep(beachW, uBeachTopM * 2.5 + beachW, vH))
1815
+ float beach = (1.0 - smoothstep(beachW, uBeachTopM * 4.5 + beachW, vH)) // 2.5->4.5x: wider grass<->sand gradient (user 2026-06-14)
1816
1816
  * (1.0 - smoothstep(0.18, 0.55, slope));
1817
1817
  // SAND BLEED (2026-06-13): patchy sand spills above the main beach line, modulated by VS
1818
1818
  // warp noise so the edge reads as wind-blown pockets, not a strict elevation cut. At peak it
@@ -1905,6 +1905,11 @@ void main() {
1905
1905
  vec3 cA = vec3(dot(albA.rgb, LUMA));
1906
1906
  vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.8; // high + low-octave normal
1907
1907
  float dispA = albA.a;
1908
+ // NO BIOME COLOR INHERITANCE (user 2026-06-14 'take away all biome color inheritance, it will
1909
+ // speed it up' -- and fixes 'sand near grass tinted green'): each layer wears its OWN material
1910
+ // color (grass/rock/sand/snow), NOT the macro biome color. mcA = layer A's base color.
1911
+ vec3 mcA = lA < 0.5 ? bcGrass : (lA < 1.5 ? bcRock : (lA < 2.5 ? bcShore : bcSnow));
1912
+ vec3 texMatColor = mcA;
1908
1913
  vec4 texAlb = vec4(cA, dispA); vec3 texNrm = nA;
1909
1914
  float splatRock = (abs(lA - 1.0) < 0.5) ? 1.0 : 0.0; // height-blend rock fraction (layer 1 = rock)
1910
1915
  if (wB > 0.02) { // second layer only where a real transition exists
@@ -1928,14 +1933,14 @@ void main() {
1928
1933
  float bSharp = waH / max(waH + wbH, 1e-4);
1929
1934
  texAlb = vec4(mix(cB, cA, bSharp), mix(dispB, dispA, bSharp));
1930
1935
  texNrm = mix(nB, nA, bSharp);
1931
- splatRock = (abs(lA - 1.0) < 0.5 ? bSharp : 0.0) + (abs(lB - 1.0) < 0.5 ? (1.0 - bSharp) : 0.0);
1936
+ vec3 mcB = lB < 0.5 ? bcGrass : (lB < 1.5 ? bcRock : (lB < 2.5 ? bcShore : bcSnow));
1937
+ texMatColor = mix(mcB, mcA, bSharp); // height-blended MATERIAL color (no biome)
1932
1938
  }
1933
1939
  // MATCH COLOR TO NORMAL (user 2026-06-14 'green grassy patches with the rock normals -- should be
1934
1940
  // rock colored or grass normals'): texNrm follows the displacement height-blend (rock on bumps in
1935
1941
  // the slope-transition band) but the macro albedo used the slope gate -> grass color under a rock
1936
1942
  // normal. Push the macro color toward bcRock by the splat's actual rock fraction so the COLOR
1937
1943
  // follows the same selection the NORMAL does (bounded -- splatRock is 0 where rock isn't in top-2).
1938
- albedo = mix(albedo, bcRock, splatRock * 0.8);
1939
1944
  float k = uTexMix * texFarFade;
1940
1945
  // macro-tinted detail (user 2026-06-10 'the textured patch must be tinted to the same shade
1941
1946
  // as the spot its replacing'): the texture contributes STRUCTURE + relative chroma only,
@@ -1949,7 +1954,7 @@ void main() {
1949
1954
  // deviation visible while the patch average lands exactly on the macro shade.
1950
1955
  float mA = uSurfMeanL[int(lA + 0.5)];
1951
1956
  float texL = wB > 0.02 ? mix(uSurfMeanL[int(lB + 0.5)], mA, bAB) : mA;
1952
- vec3 detail = texC * (albedo / max(texL, 0.02));
1957
+ vec3 detail = texC * (texMatColor / max(texL, 0.02)); // MATERIAL color * structure (no biome inheritance)
1953
1958
  // ROCK SHOWS THE TRUE PHOTO (user 2026-06-10 'we still see the original rock texture --
1954
1959
  // replace completely'): tinting rock to the macro shade just reproduced the old grey/tan,
1955
1960
  // so the rock layer takes the raw photo color; grass/sand/snow stay shade-matched.
@@ -1966,8 +1971,9 @@ void main() {
1966
1971
  // low-freq albedo is now NORMALS-ONLY (texC is luma structure), so the old raw-photo 'identity'
1967
1972
  // hue is gone; texIdent == detail = MACRO color * structure (keeps rock its macro tan-grey, not
1968
1973
  // grey). The 4x detail carries the fine structure for every material.
1969
- vec3 texIdent = texC * (albedo / max(texL, 0.02));
1970
- albedo = clamp(mix(albedo, mix(detail, texIdent, photoF), k), 0.0, 1.0);
1974
+ // base = flat MATERIAL color (far/low-k); near = structured detail. The macro biome albedo is no
1975
+ // longer the base, so NO biome color bleeds into the ground (user 'take away all biome inheritance').
1976
+ albedo = clamp(mix(texMatColor, detail, k), 0.0, 1.0);
1971
1977
  // FAKE MIDDAY AO from the displacement (user 2026-06-14 'darken the deepest parts of the
1972
1978
  // displacement textures a little'): the texture's LOWEST displacement = crevices/pits; darken
1973
1979
  // them ~18% so the surface reads as sunlit-from-above with soft self-occlusion in the lows.