mapspinner 0.1.72 → 0.1.73
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 +33 -13
package/package.json
CHANGED
package/src/shaders/terrain.glsl
CHANGED
|
@@ -223,7 +223,7 @@ uniform float uMtnBandWide; // widen mtn=smoothstep(16.8,18.6,ele
|
|
|
223
223
|
uniform float uClimateRelief; // widen wetLowFlat(0.66,0.9,humid) + coldFlat(0.18,0.34,temp) reliefMul gates
|
|
224
224
|
uniform float uIsleWide; // widen isleZone seaBias gates (50,350)+(900,1600) -> (30,600)+(600,2200)
|
|
225
225
|
uniform float uCarveWide; // widen the river/canyon/lake/dune CLIMATE gates so carve depth fades in over a wide span
|
|
226
|
-
float canyonRidgeField(vec3 dir){ return inciseRidgeField(normalize(dir) + vec3(13.7, -4.2, 8.9),
|
|
226
|
+
float canyonRidgeField(vec3 dir){ return inciseRidgeField(normalize(dir) + vec3(13.7, -4.2, 8.9), 190.0, 2.07); } // phase offset matches FS canyonMask. baseFreq 190 = ~200km gorge network (user 2026-06-14: HALVED 380->190 = fewer, wider-spaced gorges, easier for the coarse grid to represent). Shared VS carve + FS mask -> congruent by construction.
|
|
227
227
|
// CANYON cross-section now reads as a CANYON, not a V-notch: STEEP WALLS + a FLAT FLOOR.
|
|
228
228
|
// wall = a sharp smoothstep band -> the carve drops fast over a narrow ridge interval (the cliff
|
|
229
229
|
// walls), instead of the old gentle bench+gorge blend that made shallow V-troughs.
|
|
@@ -235,9 +235,12 @@ float canyonCarveM(vec3 dir, out float depth){
|
|
|
235
235
|
// WIDENED bands (user 2026-06-02 deepen+widen): the old .78/.86/.905/.93 intervals were a very
|
|
236
236
|
// narrow ridge slice -> thin hairline gorges. Widen so the canyon reads as a BROAD gorge: a wide
|
|
237
237
|
// eroded rim shoulder, a steep but visible wall, and a wide flat floor that the gorge bottoms out on.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
// GENTLER WALLS (user 2026-06-14 'make canyon slopes more gentle, easier for the rough grid to
|
|
239
|
+
// represent'): widen every band so the same depth descends over a wider ridge interval = lower
|
|
240
|
+
// gradient -> the coarse LOD grid samples the wall without aliasing the cliff.
|
|
241
|
+
float bench = smoothstep(0.50, 0.74, ridge); // wide eroded rim shoulder
|
|
242
|
+
float wall = smoothstep(0.58, 0.90, ridge); // gentle cliff wall (wide band)
|
|
243
|
+
float floorF= smoothstep(0.72, 0.96, ridge); // reach the flat gorge floor, then clamp
|
|
241
244
|
depth = max(wall, floorF);
|
|
242
245
|
// 0.18 rim shoulder + 0.82 wall-to-floor; floorF clamps so the bottom is flat (no infinite V).
|
|
243
246
|
float profile = 0.18 * bench + 0.82 * max(wall, floorF);
|
|
@@ -703,7 +706,11 @@ highp float composeHeight(vec3 dir0, highp vec2 faceLocal, float tileM){ // W7
|
|
|
703
706
|
h += cliffCarveV;
|
|
704
707
|
// FLAT RIVER WATER
|
|
705
708
|
float riverWetLine = riverWetMask * riverWet * step(0.0, h);
|
|
706
|
-
|
|
709
|
+
// DEEPER, GENTLER-APPROACH CHANNEL WATER (user 2026-06-14 'water in canyons very shallow, base flat,
|
|
710
|
+
// angle of approach to the base far too sharp'): drop the channel bed 20->70m so the water is deep
|
|
711
|
+
// enough to read, and use riverWetLine^0.6 as the carve weight so the bed eases DOWN over a wider
|
|
712
|
+
// margin (concave approach) instead of plunging at the wet edge.
|
|
713
|
+
if (riverWetLine > 0.0) { float rw = pow(riverWetLine, 0.6); float rWaterLevel = h - 70.0; h = mix(h, rWaterLevel, rw); vDisp *= (1.0 - rw); }
|
|
707
714
|
// DUNES on the low sand desert
|
|
708
715
|
float duneSand = smoothstep(mix(0.62, 0.50, uCarveWide), mix(0.85, 0.95, uCarveWide), 1.0 - hpf0.a) * smoothstep(mix(0.40, 0.30, uCarveWide), mix(0.58, 0.68, uCarveWide), hpf0.b) * (1.0 - smoothstep(40.0, 160.0, h));
|
|
709
716
|
float duneCrest; float duneV = duneFieldM(dir0, duneCrest) * duneSand * step(0.0, h);
|
|
@@ -938,12 +945,14 @@ void main() {
|
|
|
938
945
|
// water level + suppress the micro-displacement on the wet line. riverWetMask is the thalweg mask.
|
|
939
946
|
float riverWetLine = riverWetMask * riverWet * step(0.0, vH);
|
|
940
947
|
if (riverWetLine > 0.0) {
|
|
941
|
-
|
|
948
|
+
// MIRROR of composeHeight (deeper 20->70m channel + pow(.,0.6) gentler concave approach)
|
|
949
|
+
float rw = pow(riverWetLine, 0.6);
|
|
950
|
+
highp float rWaterLevel = vH - 70.0; // W7: metres
|
|
942
951
|
highp float rFloorBefore = vH;
|
|
943
|
-
vH = mix(vH, rWaterLevel,
|
|
944
|
-
vDisp *= (1.0 -
|
|
952
|
+
vH = mix(vH, rWaterLevel, rw);
|
|
953
|
+
vDisp *= (1.0 - rw); // no micro-bumps on the river surface
|
|
945
954
|
// record the deeper/stronger of lake|river as the water surface for vWaterDepth
|
|
946
|
-
if (
|
|
955
|
+
if (rw > haveWater) { waterPlane = rWaterLevel; floorBefore = rFloorBefore; haveWater = rw; }
|
|
947
956
|
}
|
|
948
957
|
// DUNES on the SAND DESERT (very dry + warm + LOW land): rolling dune relief replaces harsh rock
|
|
949
958
|
// here (ref: webgl-dunes). Gated opposite to canyons (which want elevated arid plateaus) -- dunes
|
|
@@ -1912,7 +1921,7 @@ void main() {
|
|
|
1912
1921
|
// 3 normal octaves (user 2026-06-14 'add an even lower freq octave, displacement/normals only,
|
|
1913
1922
|
// 4x less frequent'): wt4 high (detail) + wt low (2.4km) + wt*0.25 VERY-low (9.6km) -- the very-
|
|
1914
1923
|
// low one breaks the far repetition even more. Normals/displacement only (no albedo).
|
|
1915
|
-
vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.8 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lA, n) * 0.55
|
|
1924
|
+
vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lA, n) * 0.8 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lA, n) * 2.4; // very-low octave UP 0.55->2.4 (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
|
|
1916
1925
|
float dispA = albA.a;
|
|
1917
1926
|
// NO BIOME COLOR INHERITANCE (user 2026-06-14 'take away all biome color inheritance, it will
|
|
1918
1927
|
// speed it up' -- and fixes 'sand near grass tinted green'): each layer wears its OWN material
|
|
@@ -1924,7 +1933,7 @@ void main() {
|
|
|
1924
1933
|
if (wB > 0.02) { // second layer only where a real transition exists
|
|
1925
1934
|
vec4 albB = surfTriTap(uSurfAlb, wt4, tw, lB);
|
|
1926
1935
|
vec3 cB = vec3(dot(albB.rgb, LUMA));
|
|
1927
|
-
vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lB, n) * 0.8 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lB, n) *
|
|
1936
|
+
vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 1.4 + surfTriNrm(uSurfNrm, wt, tw, lB, n) * 0.8 + surfTriNrm(uSurfNrm, wt * 0.25, tw, lB, n) * 2.4; // very-low octave UP 0.55->2.4 (match nA)
|
|
1928
1937
|
float dispB = albB.a;
|
|
1929
1938
|
// HEIGHT-BLEND POKE-THROUGH (user 'each texture's higher areas should poke through the other,
|
|
1930
1939
|
// offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
|
|
@@ -2012,13 +2021,24 @@ void main() {
|
|
|
2012
2021
|
// base = flat MATERIAL color (far/low-k); near = structured detail. The macro biome albedo is no
|
|
2013
2022
|
// longer the base, so NO biome color bleeds into the ground (user 'take away all biome inheritance').
|
|
2014
2023
|
albedo = clamp(mix(texMatColor, detail, k), 0.0, 1.0);
|
|
2015
|
-
albedo = mix(albedo, biomeC, 0.
|
|
2024
|
+
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')
|
|
2016
2025
|
// FAKE MIDDAY AO from the displacement (user 2026-06-14 'darken the deepest parts of the
|
|
2017
2026
|
// displacement textures a little'): the texture's LOWEST displacement = crevices/pits; darken
|
|
2018
2027
|
// them ~18% so the surface reads as sunlit-from-above with soft self-occlusion in the lows.
|
|
2019
2028
|
// Faded by k so the far field (where the texture mips out) is untouched.
|
|
2020
|
-
|
|
2029
|
+
// STRONGER fake-midday AO (user 2026-06-14 'should be more intense, we dont really see it'):
|
|
2030
|
+
// darken the recesses harder (0.82->0.5 = up to 50%) over a wider low-displacement range so the
|
|
2031
|
+
// crevices/pits read clearly. Still faded by k so the mipped far field is untouched.
|
|
2032
|
+
float texAO = mix(1.0, mix(0.5, 1.0, smoothstep(0.05, 0.6, texAlb.a)), k);
|
|
2021
2033
|
albedo *= texAO;
|
|
2034
|
+
// ELEVATION AO (user 2026-06-14 'similar AO on elevation'): the macro analog of the displacement
|
|
2035
|
+
// AO -- darken CONCAVE relief (valley floors, gorges, recesses) using the screen-space CURVATURE
|
|
2036
|
+
// of the lit normal. curv = d(normal).d(position) / |d(position)|^2 -> +ve where the surface
|
|
2037
|
+
// curves into a pit (concave), -ve on ridges. Cheap (fwidth of the already-computed vNrm/vWorld).
|
|
2038
|
+
highp vec3 ddxP = dFdx(vWorld), ddyP = dFdy(vWorld);
|
|
2039
|
+
float curv = (dot(dFdx(vNrm), ddxP) + dot(dFdy(vNrm), ddyP)) / max(dot(ddxP, ddxP) + dot(ddyP, ddyP), 0.01);
|
|
2040
|
+
float elevAO = 1.0 - clamp(curv * 420.0, 0.0, 0.65); // concave -> darken up to 65% (user 2026-06-14 x2 'elevation based ao not visible yet': macro relief curvature is small-magnitude, needs big gain 45->420)
|
|
2041
|
+
albedo *= elevAO;
|
|
2022
2042
|
// displacement-normal relief: WORLD-SPACE UDN perturbation from surfTriNrm (each projection
|
|
2023
2043
|
// plane's tangent axes, not the radial frame). Amplitude capped low (scramble lesson d262b5e);
|
|
2024
2044
|
// applied AFTER the uReliefShade exaggeration below so the exaggeration never amplifies it.
|