mapspinner 0.1.74 → 0.1.76

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.74",
3
+ "version": "0.1.76",
4
4
  "description": "WebGL2 Earth-scale terrain rendering SDK for interactive globe applications",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -760,7 +760,6 @@ out float vLakeWet; // lake open-water mask (carve basin)
760
760
  out float vRiverWet; // river thalweg wet line
761
761
  out float vWaterDepth; // metres the flat inland-water plane sits ABOVE the local terrain floor (>0 = submerged)
762
762
  out float vCanyonDep; // canyon gorge depth [0,1]
763
- out float vConcavity; // height-field Laplacian / step^2 (1/m, +ve = concave valley/pit) -- ELEVATION AO signal (free from the normal central-diff taps)
764
763
  out float vCliffFace; // cliff/escarpment riser face [0,1] (1 = steep terrace face)
765
764
  out float vDuneCrest; // dune crest [0,1]
766
765
  out float vLevel; // quad LOD level (per-instance iOffset.w) for the patches debug view
@@ -1004,7 +1003,6 @@ void main() {
1004
1003
  // sides of a seam share the same dir0/tangent frame -> consistent normals, no row artifact.
1005
1004
  highp float hN0 = 0.0;
1006
1005
  highp vec3 vN = dir0;
1007
- highp float concavRaw = 0.0; // height Laplacian / step^2 (+ve = concave) -- set in the land branches, free from the normal taps
1008
1006
  if (uIsWater < 0.5 && uThc > 0.5) {
1009
1007
  // THC FAST PATH: height + symmetric central-diff normal from the baked pool. 5 bilinear texture
1010
1008
  // taps replace 5 full composeHeight evals (the VS-bound cost). The 4 normal taps use the SAME
@@ -1060,23 +1058,6 @@ void main() {
1060
1058
  vN = normalize(cross(wPU - wMU, wPV - wMV));
1061
1059
  if (dot(vN, dir0) < 0.0) vN = -vN; // keep it outward (terrain has no overhangs)
1062
1060
  }
1063
- // ELEVATION-AO CONCAVITY at LARGE scale (user 2026-06-14 'AO is focused on features too small, must
1064
- // AO the larger features'): the 300m normal-step Laplacian keyed on small/sharp relief (canyons). Take
1065
- // the Laplacian of broadShapeLowM (the cheap 8-oct LARGE-SCALE shape, no small carves) over a WIDE ~2km
1066
- // step instead, so the AO darkens broad valleys/basins. broadShapeLowM is the same field the mesa
1067
- // slope gate uses at a 1.2km step -> a known-cheap large-feature probe. Land only (water needs none).
1068
- if (uIsWater < 0.5) {
1069
- const highp float ecM = 2000.0; // wide finite-diff step = large-feature scale
1070
- highp vec3 ux = normalize(cross(abs(dir0.y) < 0.99 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,0.0), dir0));
1071
- highp vec3 uy = cross(dir0, ux);
1072
- highp float h0c = broadShapeLowM(dir0);
1073
- highp float hxp = broadShapeLowM(normalize(dir0 + ux * (ecM / defRadius)));
1074
- highp float hxm = broadShapeLowM(normalize(dir0 - ux * (ecM / defRadius)));
1075
- highp float hyp = broadShapeLowM(normalize(dir0 + uy * (ecM / defRadius)));
1076
- highp float hym = broadShapeLowM(normalize(dir0 - uy * (ecM / defRadius)));
1077
- concavRaw = (hxp + hxm + hyp + hym - 4.0 * h0c) / (ecM * ecM); // 1/m large-scale curvature, +ve = broad valley/basin
1078
- }
1079
- vConcavity = concavRaw;
1080
1061
  highp float h = hN0;
1081
1062
  // OCEAN TOP = A SEPARATE, ELEVATION-BASED SURFACE (user 2026-06-10: 'terrain should extend into
1082
1063
  // the ocean, the ocean top separate and elevation based'). composeHeight keeps carrying the TRUE
@@ -1154,7 +1135,6 @@ in float vLakeWet; // carve masks computed in the VS, interpolated (no per-pi
1154
1135
  in float vRiverWet;
1155
1136
  in float vWaterDepth; // metres of submerged water (>0 = real open inland water at the flat plane)
1156
1137
  in float vCanyonDep;
1157
- in float vConcavity; // elevation-AO concavity (1/m, +ve = valley/pit)
1158
1138
  in float vCliffFace;
1159
1139
  in float vDuneCrest;
1160
1140
  in float vLevel; // quad LOD level (patches view)
@@ -1941,7 +1921,7 @@ void main() {
1941
1921
  // 3 normal octaves (user 2026-06-14 'add an even lower freq octave, displacement/normals only,
1942
1922
  // 4x less frequent'): wt4 high (detail) + wt low (2.4km) + wt*0.25 VERY-low (9.6km) -- the very-
1943
1923
  // low one breaks the far repetition even more. Normals/displacement only (no albedo).
1944
- vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 2.0 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.9 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lA, n) * 1.1; // REBALANCED (user 2026-06-14 'higher octaves appear gone'): very-low 2.4 swamped the detail -> high (wt4) UP to 2.0 (dominant detail), very-low DOWN to 1.1 (still visible broad) (user 2026-06-14 'dont really see the lower freq octave yet'): at a 9.6km period its slope is gentle, so it needs more weight to read as broad undulation
1924
+ vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 2.0 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.9; // high (wt4, detail) + mid (wt, 2.4km) octaves. Lowest (wt*0.25, 9.6km) REMOVED 2026-06-14 (user 'keep the mid one, just the lowest one to be removed' -- very low visual impact)
1945
1925
  float dispA = albA.a;
1946
1926
  // NO BIOME COLOR INHERITANCE (user 2026-06-14 'take away all biome color inheritance, it will
1947
1927
  // speed it up' -- and fixes 'sand near grass tinted green'): each layer wears its OWN material
@@ -1953,7 +1933,7 @@ void main() {
1953
1933
  if (wB > 0.02) { // second layer only where a real transition exists
1954
1934
  vec4 albB = surfTriTap(uSurfAlb, wt4, tw, lB);
1955
1935
  vec3 cB = vec3(dot(albB.rgb, LUMA));
1956
- vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 2.0 + surfTriNrm(uSurfNrm, wt, tw, lB, n) * 0.9 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lB, n) * 1.1; // REBALANCED (match nA)
1936
+ vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 2.0 + surfTriNrm(uSurfNrm, wt, tw, lB, n) * 0.9; // high + mid octaves; lowest removed (match nA)
1957
1937
  float dispB = albB.a;
1958
1938
  // HEIGHT-BLEND POKE-THROUGH (user 'each texture's higher areas should poke through the other,
1959
1939
  // offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
@@ -1986,10 +1966,9 @@ void main() {
1986
1966
  // grass/sand interlocks (fingers) at ALL distances -- still the texture DISPLACEMENT, not noise.
1987
1967
  float dispA_lo = surfTriTap(uSurfAlb, wt, tw, lA).a;
1988
1968
  float dispB_lo = surfTriTap(uSurfAlb, wt, tw, lB).a;
1989
- float dispA_vlo = surfTriTap(uSurfAlb, wt * 0.25, tw, lA).a; // very-low (9.6km) displacement -> even-larger-scale boundary undulation (less repetitive far)
1990
- float dispB_vlo = surfTriTap(uSurfAlb, wt * 0.25, tw, lB).a;
1991
- float hA = (dispA - 0.5) * 1.5 + (dispA_lo - 0.5) * 2.2 + (dispA_vlo - 0.5) * 2.2 + wRamp + ordA * 0.45;
1992
- float hB = (dispB - 0.5) * 1.5 + (dispB_lo - 0.5) * 2.2 + (dispB_vlo - 0.5) * 2.2 - wRamp + ordB * 0.45;
1969
+ // very-low (9.6km) displacement taps REMOVED 2026-06-14 (user 'just the lowest one to be removed'): keep high (dispA) + mid (dispA_lo) for the LOD-stable boundary fingering.
1970
+ float hA = (dispA - 0.5) * 1.5 + (dispA_lo - 0.5) * 2.2 + wRamp + ordA * 0.45;
1971
+ float hB = (dispB - 0.5) * 1.5 + (dispB_lo - 0.5) * 2.2 - wRamp + ordB * 0.45;
1993
1972
  float mh = max(hA, hB) - bw;
1994
1973
  float waH = max(hA - mh, 0.0), wbH = max(hB - mh, 0.0);
1995
1974
  float bSharp = waH / max(waH + wbH, 1e-4);
@@ -2042,26 +2021,9 @@ void main() {
2042
2021
  // longer the base, so NO biome color bleeds into the ground (user 'take away all biome inheritance').
2043
2022
  albedo = clamp(mix(texMatColor, detail, k), 0.0, 1.0);
2044
2023
  albedo = mix(albedo, biomeC, 0.68); // climate/biome tint back on top of the material color (deserts tanner, forests greener) -- UP 0.16->0.68 (user 2026-06-14 x2 'tinting-according-to-landscape can be intensified, not really visible yet')
2045
- // FAKE MIDDAY AO from the displacement (user 2026-06-14 'darken the deepest parts of the
2046
- // displacement textures a little'): the texture's LOWEST displacement = crevices/pits; darken
2047
- // them ~18% so the surface reads as sunlit-from-above with soft self-occlusion in the lows.
2048
- // Faded by k so the far field (where the texture mips out) is untouched.
2049
- // STRONGER fake-midday AO (user 2026-06-14 'should be more intense, we dont really see it'):
2050
- // darken the recesses harder (0.82->0.5 = up to 50%) over a wider low-displacement range so the
2051
- // crevices/pits read clearly. Still faded by k so the mipped far field is untouched.
2052
- float texAO = mix(1.0, mix(0.5, 1.0, smoothstep(0.05, 0.6, texAlb.a)), k);
2053
- albedo *= texAO;
2054
- // ELEVATION AO (user 2026-06-14 x3 'similar AO on elevation / still not visible'): the screen-space
2055
- // curvature of vNrm was ~0 (vNrm is a per-vertex analytic normal, linearly interpolated -> its
2056
- // fwidth is tiny on the coarse grid = invisible). Replaced with vConcavity = the height-field
2057
- // LAPLACIAN computed FREE from the VS normal central-diff taps (1/m, +ve = concave valley/pit),
2058
- // a real object-space relief signal that survives interpolation. Darken concavities up to 65%.
2059
- // VERY GRADUAL response (user 2026-06-14 'ao works but not gradiated, must be very gradual'): the
2060
- // hard clamp(.,0.6) flat-topped every valley past a threshold = a visible AO edge + no gradation
2061
- // between medium and deep concavity. Exponential SOFT saturation instead -- monotonic, smooth
2062
- // onset AND smooth approach to the 0.6 floor, so darkening grades continuously with depth, no edge.
2063
- float elevAO = 1.0 - 0.6 * (1.0 - exp(-max(vConcavity, 0.0) * 2500.0)); // concavRaw ~=1/Rc of the LARGE shape (~3-7e-4 for km-scale basins): broad valley eases in, asymptotes to -60%
2064
- albedo *= elevAO;
2024
+ // (AO REMOVED 2026-06-14 user 'fps dropped a lot, no visual improvement, get rid of all the ao
2025
+ // for texture and landscape': the displacement texAO + the broadShapeLowM-Laplacian elevation AO
2026
+ // are both gone; the latter's 5 wide VS taps were the FPS cost. vConcavity varying also removed.)
2065
2027
  // displacement-normal relief: WORLD-SPACE UDN perturbation from surfTriNrm (each projection
2066
2028
  // plane's tangent axes, not the radial frame). Amplitude capped low (scramble lesson d262b5e);
2067
2029
  // applied AFTER the uReliefShade exaggeration below so the exaggeration never amplifies it.