mapspinner 0.1.66 → 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 +1 -1
- package/src/gl-render.js +1 -1
- package/src/shaders/terrain.glsl +18 -8
package/package.json
CHANGED
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',
|
|
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]
|
package/src/shaders/terrain.glsl
CHANGED
|
@@ -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 *
|
|
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
|
|
@@ -1917,21 +1922,25 @@ void main() {
|
|
|
1917
1922
|
// boundary); higher wins over a soft width so the loser's high bumps poke through = fingers,
|
|
1918
1923
|
// no hard line. ONE blend for ALL pairs. Mips smooth dispA/dispB at distance -> soft far edge.
|
|
1919
1924
|
float bw = 0.06; // NEAR-HARD crossover (user 2026-06-14 'make the transition hard, let the displacement make the distribution interesting -> far less blendy'): the displacement picks a sharp per-pixel winner; the gate weight only shifts the proportion across the ramp
|
|
1920
|
-
|
|
1921
|
-
|
|
1925
|
+
// weight-ramp coefficient 1.1 -> 0.5 (user 2026-06-14 'we want that crossover on ALL
|
|
1926
|
+
// crossovers'): a weaker weight ramp lets the DISPLACEMENT decide the winner over a WIDER
|
|
1927
|
+
// weight range, so the near-hard displacement-driven distribution spans a broad margin for
|
|
1928
|
+
// EVERY pair (rock-slope, snow, biome...), not just the explicitly-widened beach gate.
|
|
1929
|
+
float hA = dispA + (bAB - 0.5) * 0.5;
|
|
1930
|
+
float hB = dispB + (0.5 - bAB) * 0.5;
|
|
1922
1931
|
float mh = max(hA, hB) - bw;
|
|
1923
1932
|
float waH = max(hA - mh, 0.0), wbH = max(hB - mh, 0.0);
|
|
1924
1933
|
float bSharp = waH / max(waH + wbH, 1e-4);
|
|
1925
1934
|
texAlb = vec4(mix(cB, cA, bSharp), mix(dispB, dispA, bSharp));
|
|
1926
1935
|
texNrm = mix(nB, nA, bSharp);
|
|
1927
|
-
|
|
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)
|
|
1928
1938
|
}
|
|
1929
1939
|
// MATCH COLOR TO NORMAL (user 2026-06-14 'green grassy patches with the rock normals -- should be
|
|
1930
1940
|
// rock colored or grass normals'): texNrm follows the displacement height-blend (rock on bumps in
|
|
1931
1941
|
// the slope-transition band) but the macro albedo used the slope gate -> grass color under a rock
|
|
1932
1942
|
// normal. Push the macro color toward bcRock by the splat's actual rock fraction so the COLOR
|
|
1933
1943
|
// follows the same selection the NORMAL does (bounded -- splatRock is 0 where rock isn't in top-2).
|
|
1934
|
-
albedo = mix(albedo, bcRock, splatRock * 0.8);
|
|
1935
1944
|
float k = uTexMix * texFarFade;
|
|
1936
1945
|
// macro-tinted detail (user 2026-06-10 'the textured patch must be tinted to the same shade
|
|
1937
1946
|
// as the spot its replacing'): the texture contributes STRUCTURE + relative chroma only,
|
|
@@ -1945,7 +1954,7 @@ void main() {
|
|
|
1945
1954
|
// deviation visible while the patch average lands exactly on the macro shade.
|
|
1946
1955
|
float mA = uSurfMeanL[int(lA + 0.5)];
|
|
1947
1956
|
float texL = wB > 0.02 ? mix(uSurfMeanL[int(lB + 0.5)], mA, bAB) : mA;
|
|
1948
|
-
vec3 detail = texC * (
|
|
1957
|
+
vec3 detail = texC * (texMatColor / max(texL, 0.02)); // MATERIAL color * structure (no biome inheritance)
|
|
1949
1958
|
// ROCK SHOWS THE TRUE PHOTO (user 2026-06-10 'we still see the original rock texture --
|
|
1950
1959
|
// replace completely'): tinting rock to the macro shade just reproduced the old grey/tan,
|
|
1951
1960
|
// so the rock layer takes the raw photo color; grass/sand/snow stay shade-matched.
|
|
@@ -1962,8 +1971,9 @@ void main() {
|
|
|
1962
1971
|
// low-freq albedo is now NORMALS-ONLY (texC is luma structure), so the old raw-photo 'identity'
|
|
1963
1972
|
// hue is gone; texIdent == detail = MACRO color * structure (keeps rock its macro tan-grey, not
|
|
1964
1973
|
// grey). The 4x detail carries the fine structure for every material.
|
|
1965
|
-
|
|
1966
|
-
|
|
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);
|
|
1967
1977
|
// FAKE MIDDAY AO from the displacement (user 2026-06-14 'darken the deepest parts of the
|
|
1968
1978
|
// displacement textures a little'): the texture's LOWEST displacement = crevices/pits; darken
|
|
1969
1979
|
// them ~18% so the surface reads as sunlit-from-above with soft self-occlusion in the lows.
|