mapspinner 0.1.51 → 0.1.53
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 +12 -2
- package/src/shaders/terrain.glsl +10 -3
package/package.json
CHANGED
package/src/gl-render.js
CHANGED
|
@@ -788,7 +788,12 @@ export async function initMapspinnerRender(gl, opts = {}) {
|
|
|
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
790
|
const RHORIZON = R - 500.0;
|
|
791
|
-
|
|
791
|
+
// UNDERWATER FAR-PLANE FIX (user 2026-06-14 'at -214m visible, at -500m it disappears'): when the
|
|
792
|
+
// camera is more than 500m below sea level, camDist < RHORIZON so the sea-level horizon is imaginary
|
|
793
|
+
// (-> 0) and alt is negative; the old max(horizon, alt*8) then collapsed the far plane to ~0 and the
|
|
794
|
+
// whole scene vanished past -500m deep (= the 'ocean looks shallow/empty' when exploring). Floor the
|
|
795
|
+
// far reach to 60km when submerged so the seabed + the underwater view stay visible.
|
|
796
|
+
const horizon = (camDist > RHORIZON) ? Math.sqrt(camDist*camDist - RHORIZON*RHORIZON) : 60000.0;
|
|
792
797
|
// MATCH render()'s near exactly (2026-06-14 jank fix): the cull frustum must use the SAME near
|
|
793
798
|
// as the draw frustum, else behind-limb/screen-AABB culling diverges from what is actually drawn
|
|
794
799
|
// at the deck (cull near was max(*0.1,0.1) while render used the <2m 0.05 branch).
|
|
@@ -831,7 +836,12 @@ export async function initMapspinnerRender(gl, opts = {}) {
|
|
|
831
836
|
// extends the horizon to tens of km at low altitude so near-shore relief stays in view (negligible
|
|
832
837
|
// depth-precision cost: 500m vs R~6.37e6). Both the cull and the draw use this (single source).
|
|
833
838
|
const RHORIZON = R - 500.0;
|
|
834
|
-
|
|
839
|
+
// UNDERWATER FAR-PLANE FIX (user 2026-06-14 'at -214m visible, at -500m it disappears'): when the
|
|
840
|
+
// camera is more than 500m below sea level, camDist < RHORIZON so the sea-level horizon is imaginary
|
|
841
|
+
// (-> 0) and alt is negative; the old max(horizon, alt*8) then collapsed the far plane to ~0 and the
|
|
842
|
+
// whole scene vanished past -500m deep (= the 'ocean looks shallow/empty' when exploring). Floor the
|
|
843
|
+
// far reach to 60km when submerged so the seabed + the underwater view stay visible.
|
|
844
|
+
const horizon = (camDist > RHORIZON) ? Math.sqrt(camDist*camDist - RHORIZON*RHORIZON) : 60000.0;
|
|
835
845
|
const near = altAboveTerrain < 2.0 ? 0.05 : Math.max(altAboveTerrain * 0.1, 0.05);
|
|
836
846
|
const _fBlend = Math.min(1.0, Math.max(0.0, (alt - 500000.0) / 4500000.0));
|
|
837
847
|
const farGround = Math.max(horizon, alt * 8.0);
|
package/src/shaders/terrain.glsl
CHANGED
|
@@ -2179,10 +2179,17 @@ void main() {
|
|
|
2179
2179
|
// under the ocean'): the old absorb (4,0.8,0.3)/km + a 50->500m hard fog fade closed the view to
|
|
2180
2180
|
// opaque blue within ~500m. Lower the coefficients (still red-first absorption) and push the hard
|
|
2181
2181
|
// fade to ~3-15km so the seabed landscape is explorable; red still fades fast (realistic blue cast).
|
|
2182
|
-
|
|
2182
|
+
// MUCH CLEARER (user 2026-06-14 'we cant see the ocean floor properly'): the deep-ocean floor is
|
|
2183
|
+
// km below, so even 'clear' (1.0/0.30/0.15) water + a 3-15km fade hid it. Drop the coefficients
|
|
2184
|
+
// hard and push the fade to ~10-50km so the ocean FLOOR reads as terrain from a long way off
|
|
2185
|
+
// (game-clarity over physical realism; red still absorbs first for a natural blue-green cast).
|
|
2186
|
+
// FOG 10x LESS (user 2026-06-14 'make the fog 10x less / doesnt look right under the water'):
|
|
2187
|
+
// extinction /10 and the hard fade pushed 10x out so the ocean floor reads clearly from a long
|
|
2188
|
+
// way off with only a faint blue tint, not a wash of fog.
|
|
2189
|
+
vec3 absorb = vec3(0.035, 0.010, 0.005) * (1.0 + depth * 0.0001);
|
|
2183
2190
|
vec3 uwTrans = exp(-absorb * dKm);
|
|
2184
|
-
vec3 uwFog = vec3(0.004, 0.
|
|
2185
|
-
color = mix(color * uwTrans + uwFog * (1.0 - uwTrans), uwFog, smoothstep(
|
|
2191
|
+
vec3 uwFog = vec3(0.004, 0.09, 0.18) + vec3(0.0, 0.015, 0.03) * depth / 1000.0;
|
|
2192
|
+
color = mix(color * uwTrans + uwFog * (1.0 - uwTrans), uwFog, smoothstep(100000.0, 500000.0, dKm * 1000.0));
|
|
2186
2193
|
}
|
|
2187
2194
|
// RIVERS post-lighting (witnessed browser-2115/2118: the river-blue in ALBEDO is multiplied
|
|
2188
2195
|
// by the warm sun irradiance (sunIrr.b is low) so land rivers lose their blue in the lit
|