generate terrain height as Rivers' GenTerra does

98.2% of stored columns match exactly; the rest is the dry seabed
raise and surface caves, both later passes that the strata never see.
GenTerra thresholds the new terrain noise through the old tanh curve's
inverse, and matching that quirk is what moved it from 87%.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 19:10:54 +03:00
parent 517d279c8d
commit c4c7ab9968
10 changed files with 1248 additions and 33 deletions

View File

@@ -408,22 +408,43 @@ Viewer:
- *Hover info.* River distance and bank depth.
- *World panel.* A rivers config path; empty means the mod's defaults.
** 5. Terrain height
- Port =NewGenTerra='s per-column path:
- landform weights (lerped, radius 3) with the river landform;
- valley blend;
- warp distortion (seed+9876/+9878);
- oceanicity and upheaval distY;
- =NoiseSign= with the bounds early-out;
- carving.
- Port the dry-climate raise from =GenBlockLayers=, with the Rivers patch
factor applied, so we can compare against stored heights. The Rivers
transpiler is IL pattern matching, so whether it applies in 1.22.7
will show up in the diff.
- =vsmv verify-height= compares against =WorldGenTerrainHeightMap= for
all 11,414 stored map chunks. It reports the match percentage and
writes a diff PNG.
- Viewer: hillshaded terrain with water.
** 5. Terrain height (done)
=src/terra.sex= ports Rivers' NewGenTerra per column. That covers:
- the landform weights (LerpedWeightedIndex2DMap);
- per-Y thresholds;
- fair-warp distortion, oceanicity and upheaval;
- NewNormalizedSimplexFractalNoise with its stateful =NoiseSign=;
- the valley blend toward Rivers' river landform;
- riverbed carving.
It returns the top solid block, which is the height the strata are
laid from. A chunk's bulk-solid layers reduce to a per-column rule.
With a river column in the chunk, Rivers disables those layers, which
lets carving reach y = 1.
Against the 11,687,936 stored columns:
- *Exact:* 11,481,361 (98.2%).
- *Stored higher, under water:* 141,978. GenBlockLayers raises dry
seabeds after the strata.
- *Stored lower, on land:* 77,222. GenCaves lowers the height where a
cave opens the surface.
- *Unexplained:* 2,810, or 0.02%, likely the two passes combined.
Neither later pass matters for the rock overlay. The raise only stacks
more of the top rock, and caves don't change which stratum a block
belongs to.
The fix that took it from 87% to 98%: GenTerra turns its threshold into
a noise value with =NormalizedSimplexNoise.NoiseValueCurveInverse=,
the inverse of the *tanh* curve. The column bounds use the new noise's
own =v / sqrt(1 + v^2)= curve. Vanilla does the same.
Viewer:
- *Terrain height layer.* Water depth below sea level, elevation and
hillshade above.
- *Sampling.* Every 1 to 32 blocks depending on zoom; a column costs
about 11 us.
- *Hover info.* Shows the height.
** 6. Rock strata + overlay
- Port =GenRockStrataNew.genBlockColumn=: