mapspinner 0.1.63 → 0.1.65
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 +1 -1
- package/src/gl-render.js +4 -4
- package/src/shaders/terrain.glsl +17 -3
package/package.json
CHANGED
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 -
|
|
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.
|
|
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 -
|
|
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.
|
|
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;
|
package/src/shaders/terrain.glsl
CHANGED
|
@@ -1410,7 +1410,13 @@ vec3 terrainAlbedoClimate(float h, float slope, float rockSlope, float temp, flo
|
|
|
1410
1410
|
// vegetation dropped out a beat BEFORE the rock arrived -> a light bare-grass ring. Key veg off the
|
|
1411
1411
|
// SAME rockSlope so vegetation fades EXACTLY as rock fades in -> grass stays dark right up to the
|
|
1412
1412
|
// rock with no light gap, and veg is 0 wherever rock is full (no biome-green bleeding onto rock).
|
|
1413
|
-
|
|
1413
|
+
// BREAK THE VEG RING (user 2026-06-14 'hard separation between dark and light grass, a hard circle
|
|
1414
|
+
// around mountains'): veg dropped at a clean elevation+slope threshold -> a dark->light grass ring
|
|
1415
|
+
// circling every peak. Warp BOTH thresholds with ONE cheap noise (~2-3km) so the dark/light grass
|
|
1416
|
+
// boundary fingers irregularly instead of a contour ring. (Reuses the hoisted nwp; one snoise3.)
|
|
1417
|
+
float vegN = snoise3(nwp * 2400.0);
|
|
1418
|
+
float veg = (1.0 - smoothstep(bandEdgesHi.x + vegN * 850.0, bandEdgesHi.y + vegN * 850.0, h))
|
|
1419
|
+
* (1.0 - smoothstep(slopeRock.x, slopeRock.y + vegN * 0.13, rockSlope));
|
|
1414
1420
|
// ELEVATION + LATITUDE BIOME BIAS (user 2026-06-02: 'the hypsometric ramp should influence biome
|
|
1415
1421
|
// distribution, pulling biomes out of their anchor areas a bit for better distribution'). On top
|
|
1416
1422
|
// of the anchor climate temp/humid, bias the EFFECTIVE temperature DOWN with elevation (lapse rate
|
|
@@ -1886,14 +1892,22 @@ void main() {
|
|
|
1886
1892
|
// off (= the old low-freq look) -- no second octave, no detailFade. Albedo = luma STRUCTURE (macro
|
|
1887
1893
|
// color carries chroma); normal strong (x1.4); displacement drives the height-blend (mips soften
|
|
1888
1894
|
// the displacement, and thus the blend, at distance automatically).
|
|
1895
|
+
// LOW-OCTAVE NORMAL BLEND (user 2026-06-14 'blend the higher octave with the lower octave's
|
|
1896
|
+
// NORMALS for a less repetitive faraway look -- dont fade it, draw both'): the high octave (wt4)
|
|
1897
|
+
// tiles tightly so it repeats visibly far off; ADD the low octave (wt, 2.4km, less repetitive)
|
|
1898
|
+
// NORMAL on top -- ALWAYS, no fade -- to break that repetition. Albedo stays high-octave only.
|
|
1889
1899
|
highp vec3 wt4 = wt * 4.0;
|
|
1890
1900
|
vec4 albA = surfTriTap(uSurfAlb, wt4, tw, lA);
|
|
1891
|
-
vec3 cA = vec3(dot(albA.rgb, LUMA));
|
|
1901
|
+
vec3 cA = vec3(dot(albA.rgb, LUMA));
|
|
1902
|
+
vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.8; // high + low-octave normal
|
|
1903
|
+
float dispA = albA.a;
|
|
1892
1904
|
vec4 texAlb = vec4(cA, dispA); vec3 texNrm = nA;
|
|
1893
1905
|
float splatRock = (abs(lA - 1.0) < 0.5) ? 1.0 : 0.0; // height-blend rock fraction (layer 1 = rock)
|
|
1894
1906
|
if (wB > 0.02) { // second layer only where a real transition exists
|
|
1895
1907
|
vec4 albB = surfTriTap(uSurfAlb, wt4, tw, lB);
|
|
1896
|
-
vec3 cB = vec3(dot(albB.rgb, LUMA));
|
|
1908
|
+
vec3 cB = vec3(dot(albB.rgb, LUMA));
|
|
1909
|
+
vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lB, n) * 0.8; // high + low-octave normal
|
|
1910
|
+
float dispB = albB.a;
|
|
1897
1911
|
// HEIGHT-BLEND POKE-THROUGH (user 'each texture's higher areas should poke through the other,
|
|
1898
1912
|
// offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
|
|
1899
1913
|
// boundary); higher wins over a soft width so the loser's high bumps poke through = fingers,
|