mapspinner 0.1.60 → 0.1.62
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 -33
- package/src/terrain-gen-controls.js +1 -1
package/package.json
CHANGED
package/src/shaders/terrain.glsl
CHANGED
|
@@ -1237,7 +1237,11 @@ uniform vec4 uSurfMeanL; // per-layer mean linear luminance of the photo col
|
|
|
1237
1237
|
// binary boundary snaps material across wide areas instead of softly interfingering, and the high-freq
|
|
1238
1238
|
// octave aliased on bright materials. Reverted to the clean smoothstep boundaries; a non-aliasing
|
|
1239
1239
|
// 'interesting boundary' technique (e.g. a wide soft transition material band) is a separate future task.
|
|
1240
|
-
vec3 terrainAlbedo(float h, float slope, float rockSlope, highp vec3 worldPos) { // highp: worldPos feeds normalize(worldPos)*freq noise UVs -- mediump would scramble the lattice at close range
|
|
1240
|
+
vec3 terrainAlbedo(float h, float slope, float rockSlope, highp vec3 worldPos, float pxW) { // highp: worldPos feeds normalize(worldPos)*freq noise UVs -- mediump would scramble the lattice at close range
|
|
1241
|
+
// DISTANCE-WIDENED rock-slope band (user 2026-06-14 'hard edge to rock slopes at a distance'): the
|
|
1242
|
+
// close-up height-blend doesn't run far off, so the macro slope gate showed a hard edge. Widen its
|
|
1243
|
+
// upper threshold with distance so the rock->grass slope boundary fades softly when it's far.
|
|
1244
|
+
float rockWiden = smoothstep(20.0, 500.0, pxW) * 0.20;
|
|
1241
1245
|
vec3 c;
|
|
1242
1246
|
if (h < 0.0) {
|
|
1243
1247
|
// SEABED CONTINUES AS LAND MATERIAL (user 2026-06-11 'instead of turning terrain into water,
|
|
@@ -1258,7 +1262,7 @@ vec3 terrainAlbedo(float h, float slope, float rockSlope, highp vec3 worldPos) {
|
|
|
1258
1262
|
float bandWarp = (snoise3(bww * 210.0) * 1.0 + snoise3(bww * 560.0) * 0.5 + snoise3(bww * 1450.0) * 0.25) * 720.0;
|
|
1259
1263
|
c = mix(c, bcRock, smoothstep(bandEdgesHi.x + bandWarp, bandEdgesHi.y + bandWarp, h));
|
|
1260
1264
|
c = mix(c, bcSnow, smoothstep(snowEdges.x + bandWarp, snowEdges.y + bandWarp, h));
|
|
1261
|
-
c = mix(c, bcRock, smoothstep(slopeRock.x, slopeRock.y, rockSlope) * step(0.0, h));
|
|
1265
|
+
c = mix(c, bcRock, smoothstep(slopeRock.x, slopeRock.y + rockWiden, rockSlope) * step(0.0, h));
|
|
1262
1266
|
// OLD PROCEDURAL GREY ROCKFACE DELETED (max-speed sweep 2026-06-10, user 'replace the original
|
|
1263
1267
|
// rock completely'): the photo-rock splat owns steep faces; the 3-tap grey fBm fallback is gone.
|
|
1264
1268
|
}
|
|
@@ -1300,7 +1304,7 @@ vec3 biomeColor(float temp, float humid) {
|
|
|
1300
1304
|
// FOREST vs MEADOW split (user: they must look distinct, not one green). A CRISPER humidity
|
|
1301
1305
|
// boundary (0.48->0.56, was 0.46->0.66) so meadow (drier-temperate) and forest (wetter) read
|
|
1302
1306
|
// as DISTINCT adjacent regions instead of a long ambiguous blend; very-wet deepens to canopy.
|
|
1303
|
-
float wet = smoothstep(0.
|
|
1307
|
+
float wet = smoothstep(0.40, 0.66, humid); // WIDENED 0.48-0.56 -> 0.40-0.66 (user 2026-06-14 'hard lines between light and dark grass'): soft meadow<->forest blend, not a crisp line
|
|
1304
1308
|
float veryWet = smoothstep(0.62, 0.80, humid);
|
|
1305
1309
|
vec3 c = MEADOW; // temperate mid-humidity default
|
|
1306
1310
|
c = mix(c, FOREST, wet); // wet -> forest (crisp boundary)
|
|
@@ -1391,7 +1395,7 @@ float canyonMask(vec3 worldPos, float h, float temp, float humid, float px, out
|
|
|
1391
1395
|
#endif // biomeClassColor/riverMask/canyonMask: DEBUGVIEW-only (called solely from displayMode blocks) -- excluded from render FS cold-compile (FS-2, workflow w4y1bnrqc)
|
|
1392
1396
|
|
|
1393
1397
|
vec3 terrainAlbedoClimate(float h, float slope, float rockSlope, float temp, float humid, highp vec3 worldPos, float pxWorld) { // highp: worldPos feeds normalize(worldPos)*freq noise UVs (mottle/river/canyon ridge) -- mediump scrambles the lattice up close
|
|
1394
|
-
vec3 c = terrainAlbedo(h, slope, rockSlope, worldPos);
|
|
1398
|
+
vec3 c = terrainAlbedo(h, slope, rockSlope, worldPos, pxWorld);
|
|
1395
1399
|
if (h < 0.0) {
|
|
1396
1400
|
// SEA ICE: near-polar ocean (very cold) freezes to white-blue pack ice. Pure fn of the
|
|
1397
1401
|
// anchor temp -> seam-safe; the soft threshold gives an irregular (not hard-zonal) margin.
|
|
@@ -1873,38 +1877,26 @@ void main() {
|
|
|
1873
1877
|
wt += vTexWarp * uTexWarp;
|
|
1874
1878
|
vec3 tw = abs(n); tw = tw * tw; tw /= (tw.x + tw.y + tw.z + 1e-4);
|
|
1875
1879
|
const vec3 LUMA = vec3(0.299, 0.587, 0.114);
|
|
1876
|
-
float detailFade = (1.0 - smoothstep(1.0, 12.0, pxWorld));
|
|
1877
1880
|
float bAB = clamp(wA / max(wA + wB, 1e-4), 0.0, 1.0);
|
|
1878
|
-
//
|
|
1879
|
-
//
|
|
1880
|
-
// (
|
|
1881
|
-
//
|
|
1882
|
-
//
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
cA *= mix(1.0, clamp(dot(dA.rgb, LUMA) / max(dot(cA, LUMA), 0.04), 0.35, 2.4), detailFade * 1.3);
|
|
1888
|
-
nA += surfTriNrm(uSurfNrm, wt * 4.0, tw, lA, n) * detailFade * 1.4;
|
|
1889
|
-
dispA = mix(dispA, dA.a, detailFade); // fine displacement poke near the deck
|
|
1890
|
-
}
|
|
1881
|
+
// SINGLE HIGH-FREQUENCY OCTAVE + MIPS (user 2026-06-14 'instead of swapping out texture octaves,
|
|
1882
|
+
// just use the highest one and let it mip and get rid of the fade-in'): sample the material at the
|
|
1883
|
+
// FINE scale (wt*4, ~0.6m/texel) at EVERY distance and let the GPU mip chain average it down far
|
|
1884
|
+
// off (= the old low-freq look) -- no second octave, no detailFade. Albedo = luma STRUCTURE (macro
|
|
1885
|
+
// color carries chroma); normal strong (x1.4); displacement drives the height-blend (mips soften
|
|
1886
|
+
// the displacement, and thus the blend, at distance automatically).
|
|
1887
|
+
highp vec3 wt4 = wt * 4.0;
|
|
1888
|
+
vec4 albA = surfTriTap(uSurfAlb, wt4, tw, lA);
|
|
1889
|
+
vec3 cA = vec3(dot(albA.rgb, LUMA)); vec3 nA = surfTriNrm(uSurfNrm, wt4, tw, lA, n) * 1.4; float dispA = albA.a;
|
|
1891
1890
|
vec4 texAlb = vec4(cA, dispA); vec3 texNrm = nA;
|
|
1891
|
+
float splatRock = (abs(lA - 1.0) < 0.5) ? 1.0 : 0.0; // height-blend rock fraction (layer 1 = rock)
|
|
1892
1892
|
if (wB > 0.02) { // second layer only where a real transition exists
|
|
1893
|
-
vec4 albB = surfTriTap(uSurfAlb,
|
|
1894
|
-
vec3 cB = vec3(dot(albB.rgb, LUMA)); vec3 nB = surfTriNrm(uSurfNrm,
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
}
|
|
1901
|
-
// HEIGHT-BLEND POKE-THROUGH (user 2026-06-14 'each texture's higher areas should poke through
|
|
1902
|
-
// the other, offset by the ramp'): each layer's height = its DISPLACEMENT + a weight-ramp
|
|
1903
|
-
// offset (so the gate still positions the boundary). The higher height wins, blended over a
|
|
1904
|
-
// soft WIDTH so the loser's high bumps still poke through near the ramp -> interlocking
|
|
1905
|
-
// fingers, never a hard line. This is the ONE blend for ALL pairs (slope-rock, height-snow,
|
|
1906
|
-
// climate/area-biome, beach). bw widens close-up (where the detail is rich) for a softer mesh.
|
|
1907
|
-
float bw = mix(0.12, 0.30, detailFade);
|
|
1893
|
+
vec4 albB = surfTriTap(uSurfAlb, wt4, tw, lB);
|
|
1894
|
+
vec3 cB = vec3(dot(albB.rgb, LUMA)); vec3 nB = surfTriNrm(uSurfNrm, wt4, tw, lB, n) * 1.4; float dispB = albB.a;
|
|
1895
|
+
// HEIGHT-BLEND POKE-THROUGH (user 'each texture's higher areas should poke through the other,
|
|
1896
|
+
// offset by the ramp'): height = displacement + a weight-ramp offset (gate positions the
|
|
1897
|
+
// boundary); higher wins over a soft width so the loser's high bumps poke through = fingers,
|
|
1898
|
+
// no hard line. ONE blend for ALL pairs. Mips smooth dispA/dispB at distance -> soft far edge.
|
|
1899
|
+
float bw = 0.25;
|
|
1908
1900
|
float hA = dispA + (bAB - 0.5) * 1.1;
|
|
1909
1901
|
float hB = dispB + (0.5 - bAB) * 1.1;
|
|
1910
1902
|
float mh = max(hA, hB) - bw;
|
|
@@ -1912,7 +1904,14 @@ void main() {
|
|
|
1912
1904
|
float bSharp = waH / max(waH + wbH, 1e-4);
|
|
1913
1905
|
texAlb = vec4(mix(cB, cA, bSharp), mix(dispB, dispA, bSharp));
|
|
1914
1906
|
texNrm = mix(nB, nA, bSharp);
|
|
1907
|
+
splatRock = (abs(lA - 1.0) < 0.5 ? bSharp : 0.0) + (abs(lB - 1.0) < 0.5 ? (1.0 - bSharp) : 0.0);
|
|
1915
1908
|
}
|
|
1909
|
+
// MATCH COLOR TO NORMAL (user 2026-06-14 'green grassy patches with the rock normals -- should be
|
|
1910
|
+
// rock colored or grass normals'): texNrm follows the displacement height-blend (rock on bumps in
|
|
1911
|
+
// the slope-transition band) but the macro albedo used the slope gate -> grass color under a rock
|
|
1912
|
+
// normal. Push the macro color toward bcRock by the splat's actual rock fraction so the COLOR
|
|
1913
|
+
// follows the same selection the NORMAL does (bounded -- splatRock is 0 where rock isn't in top-2).
|
|
1914
|
+
albedo = mix(albedo, bcRock, splatRock * 0.8);
|
|
1916
1915
|
float k = uTexMix * texFarFade;
|
|
1917
1916
|
// macro-tinted detail (user 2026-06-10 'the textured patch must be tinted to the same shade
|
|
1918
1917
|
// as the spot its replacing'): the texture contributes STRUCTURE + relative chroma only,
|
|
@@ -37,7 +37,7 @@ const DEFAULTS = {
|
|
|
37
37
|
bcLowland: [0.20,0.34,0.15], bcGrass: [0.26,0.40,0.17], bcRock: [0.52,0.43,0.34], // bcRock -> a clearly WARMER TAN-GREY (R>G>B) so it reads as ROCK when lit, not olive-green (the [0.46,0.42,0.37] near-grey read green next to the biome). state.biome OVERRIDES gl-render defaults via window.__gen.
|
|
38
38
|
bcSnow: [0.92,0.94,0.97],
|
|
39
39
|
bandEdgesLo: [150.0,1200.0], bandEdgesHi: [3500.0,6500.0], snowEdges: [6000.0,8500.0], // 8000/10500->6000/8500 (user 2026-06-11 'snowy mountains disappeared' -- see gl-render snowEdges note) // snowEdges 5200/7000->8000/10500 (user 2026-06-10 'entire terrain white': the rock-by-height fix unmasked snow gates tuned pre-4x; full snow from 5.2km whitened the 11.6km massifs; coldSnow onset = snowEdges.x*0.5 follows) // bandEdgesHi 1600/3200->3500/6500 (user 2026-06-10 'rockface everywhere'): tuned on the pre-4x terrain; with 11.6km peaks everything above 3200m read rock BY HEIGHT alone -- rescale the treeline to the new elevation range
|
|
40
|
-
seaDepthM: 3000.0, slopeRock: [0.0,0.
|
|
40
|
+
seaDepthM: 3000.0, slopeRock: [-0.0,0.4], // [-0.0,0.4] USER-SET 2026-06-14 (wider rock-slope band)
|
|
41
41
|
},
|
|
42
42
|
// REAL-WORLD LOOK overhaul (terraformable lighting/shading levers; applyShaderGlobals sets window
|
|
43
43
|
// globals; gl-render reads them via _g()). Beer-Lambert ocean, biome sat, mottle, sky-fill relief,
|