mapspinner 0.1.68 → 0.1.70
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/shaders/terrain.glsl +32 -5
package/package.json
CHANGED
package/src/shaders/terrain.glsl
CHANGED
|
@@ -1798,7 +1798,12 @@ void main() {
|
|
|
1798
1798
|
highp vec3 bwDir = nWorld;
|
|
1799
1799
|
// 3-oct (added the ~1km octave, user 2026-06-14 'make biome bands more interesting') -> the
|
|
1800
1800
|
// texture-splat rock/snow/beach edges break into finer fingers as you approach, not a hard band.
|
|
1801
|
-
|
|
1801
|
+
// HIGHER-FREQ octaves added (user 2026-06-14 'sand-grass crossover too straight; snow warps ok
|
|
1802
|
+
// but sand-grass doesnt'): the snow line follows the mountains so it reads wavy, but the beach
|
|
1803
|
+
// sits on flat coastal land where the old 12/5/2.3km warp shifted the line UNIFORMLY = still a
|
|
1804
|
+
// straight horizontal line. Add ~900m + ~360m octaves so the beach/biome edges wiggle locally.
|
|
1805
|
+
float warpN = snoise3(bwDir * 3325.0) + 0.5 * snoise3(bwDir * 7750.0) + 0.4 * snoise3(bwDir * 17000.0)
|
|
1806
|
+
+ 0.45 * snoise3(bwDir * 45000.0) + 0.32 * snoise3(bwDir * 110000.0); // ~ +/-2.6
|
|
1802
1807
|
// BEACH sand gate tied to uBeachTopM (so the sand TEXTURE scales with the wide beach, not a
|
|
1803
1808
|
// hardcoded 80m strip) + the shared warp on its LAND edge so the beach->grass line is irregular.
|
|
1804
1809
|
// FINE BREAK on the grass->sand line (user 2026-06-14 'still a hard straight grass-sand line up
|
|
@@ -1812,7 +1817,7 @@ void main() {
|
|
|
1812
1817
|
// displacement height-blend (small bw below) so sand vs grass is a sharp choice distributed by
|
|
1813
1818
|
// texture relief = interlocking fingers that thin out with height, never a blendy fade.
|
|
1814
1819
|
float beachW = warpN * uBeachTopM * 0.30; // warp amplitude scales with the beach band height
|
|
1815
|
-
float beach = (1.0 - smoothstep(beachW, uBeachTopM *
|
|
1820
|
+
float beach = (1.0 - smoothstep(beachW, uBeachTopM * 0.5 + beachW, vH)) // 2.0->0.5x: 4x narrower grass<->sand crossover band (user 2026-06-14)
|
|
1816
1821
|
* (1.0 - smoothstep(0.18, 0.55, slope));
|
|
1817
1822
|
// SAND BLEED (2026-06-13): patchy sand spills above the main beach line, modulated by VS
|
|
1818
1823
|
// warp noise so the edge reads as wind-blown pockets, not a strict elevation cut. At peak it
|
|
@@ -1926,15 +1931,37 @@ void main() {
|
|
|
1926
1931
|
// crossovers'): a weaker weight ramp lets the DISPLACEMENT decide the winner over a WIDER
|
|
1927
1932
|
// weight range, so the near-hard displacement-driven distribution spans a broad margin for
|
|
1928
1933
|
// EVERY pair (rock-slope, snow, biome...), not just the explicitly-widened beach gate.
|
|
1929
|
-
|
|
1930
|
-
|
|
1934
|
+
// AMPLIFY the displacement's influence (user 2026-06-14 'the high-freq textures arent
|
|
1935
|
+
// affecting the crossover point yet'): the raw displacement sits near its 0.5 mean so the
|
|
1936
|
+
// per-layer DIFFERENCE was tiny -> the crossover was weight-driven, not texture-driven. Center
|
|
1937
|
+
// + scale it (x3) so the high-freq relief clearly decides the boundary; the weight just
|
|
1938
|
+
// positions it. (Mips average the displacement to ~0.5 at distance -> auto-smooth far edge.)
|
|
1939
|
+
// NON-LINEAR weight ramp (user 2026-06-14 'the ramp isnt complete enough between sections ->
|
|
1940
|
+
// cutoff lines at the end'): a CONSTANT weight bias let displacement fingers survive right up
|
|
1941
|
+
// to where the gate drops the layer = a hard cutoff line. Make the bias WEAK mid-ramp (wide
|
|
1942
|
+
// displacement crossover) and STRONG at the ends so the fingers taper to nothing before the
|
|
1943
|
+
// gate cuts off -> the ramp completes smoothly, no end line.
|
|
1944
|
+
float wRamp = (bAB - 0.5) * mix(1.4, 4.0, clamp(abs(bAB - 0.5) * 2.0, 0.0, 1.0)); // mid 0.6->1.4 (user 2026-06-14 'all crossover bands a bit wide, rock too'): stronger weight bias = NARROWER displacement crossover on every pair
|
|
1945
|
+
// OVERLAY ORDER (user 2026-06-14 'flip the order of the textures overlay on the ramps, grass
|
|
1946
|
+
// goes over sand etc'): bias the height by a per-material overlay priority so the COVERING
|
|
1947
|
+
// material wins the crossover -> grass overlays sand+rock, snow overlays all (sand<rock<grass<snow).
|
|
1948
|
+
float ordA = lA < 0.5 ? 0.6 : (lA < 1.5 ? 0.3 : (lA < 2.5 ? 0.0 : 1.0));
|
|
1949
|
+
float ordB = lB < 0.5 ? 0.6 : (lB < 1.5 ? 0.3 : (lB < 2.5 ? 0.0 : 1.0));
|
|
1950
|
+
// LOD-STABLE boundary (user 2026-06-14 'still see the hard color line' -- the high-octave
|
|
1951
|
+
// displacement mips FLAT at distance so the crossover collapsed to a smooth ramp = a line/band).
|
|
1952
|
+
// Add the LOW-octave (2.4km tile) displacement, which stays varied much farther out, so the
|
|
1953
|
+
// grass/sand interlocks (fingers) at ALL distances -- still the texture DISPLACEMENT, not noise.
|
|
1954
|
+
float dispA_lo = surfTriTap(uSurfAlb, wt, tw, lA).a;
|
|
1955
|
+
float dispB_lo = surfTriTap(uSurfAlb, wt, tw, lB).a;
|
|
1956
|
+
float hA = (dispA - 0.5) * 1.8 + (dispA_lo - 0.5) * 2.8 + wRamp + ordA * 0.45;
|
|
1957
|
+
float hB = (dispB - 0.5) * 1.8 + (dispB_lo - 0.5) * 2.8 - wRamp + ordB * 0.45;
|
|
1931
1958
|
float mh = max(hA, hB) - bw;
|
|
1932
1959
|
float waH = max(hA - mh, 0.0), wbH = max(hB - mh, 0.0);
|
|
1933
1960
|
float bSharp = waH / max(waH + wbH, 1e-4);
|
|
1934
1961
|
texAlb = vec4(mix(cB, cA, bSharp), mix(dispB, dispA, bSharp));
|
|
1935
1962
|
texNrm = mix(nB, nA, bSharp);
|
|
1936
1963
|
vec3 mcB = lB < 0.5 ? bcGrass : (lB < 1.5 ? bcRock : (lB < 2.5 ? bcShore : bcSnow));
|
|
1937
|
-
texMatColor = mix(mcB, mcA, bSharp); //
|
|
1964
|
+
texMatColor = mix(mcB, mcA, bSharp); // material color, broken up by the (noise-augmented) bSharp below
|
|
1938
1965
|
}
|
|
1939
1966
|
// MATCH COLOR TO NORMAL (user 2026-06-14 'green grassy patches with the rock normals -- should be
|
|
1940
1967
|
// rock colored or grass normals'): texNrm follows the displacement height-blend (rock on bumps in
|