add recharge

This commit is contained in:
2026-11-10 19:54:00 +01:00
parent ea0eedc0fb
commit 772d4494e8
30 changed files with 1357 additions and 1073 deletions
+13 -4
View File
@@ -30,6 +30,8 @@ uniform vec3 roadBorderColor;
uniform float time;
uniform int riverMask;
uniform float waterLevelKm = 0.08235294;
uniform float coastBeachWidthKm = 0.022;
smooth in vec3 vNormal;
smooth in vec3 vWorldPos;
@@ -232,8 +234,12 @@ void main() {
// Snowline in kilometers: 2.5 (2500m) in temperate zone, dropping to 0.0 (sea level) at poles!
float snowLine = mix(2.5, 0.0, poleFactor);
// 3. Water vs Land detection (z_pos = height in kilometers, 0.0 = sea level)
float oceanWaterFac = 1.0 - smoothstep(0.005, 0.025, z_pos);
// 3. Water vs Land detection (z_pos = height in kilometers; water is height < water_height_threshold)
// One heightmap step is 3.5 / 255.0 = 0.0137255 km, so height = threshold - 1 is at waterLevelKm - 0.0137255.
// All water hexes (height <= threshold - 1) remain 100% water and transition smoothly across the shoreline.
float waterEdgeLow = max(0.0, waterLevelKm - 0.0135);
float waterEdgeHigh = max(waterEdgeLow + 0.002, waterLevelKm - 0.0015);
float oceanWaterFac = 1.0 - smoothstep(waterEdgeLow, waterEdgeHigh, z_pos);
// River water detection
float riverDist = getRiverDistance(fragVert.xy, riverMask);
@@ -321,10 +327,13 @@ void main() {
biomeGround = farmColor;
}
// Shoreline beach: where gentle slopes meet water (sea level up to ~110m, or along rivers)
// Shoreline beach: where gentle slopes meet water right along the waterline (or along rivers)
// Steep slopes (norm.z < 0.55) remain rocky cliffs; gentle slopes (norm.z > 0.80) get a sandy beach
float gentleSlope = smoothstep(0.55, 0.85, norm.z);
float coastBeach = (1.0 - smoothstep(0.015, 0.110, z_pos)) * smoothstep(0.003, 0.015, z_pos) * gentleSlope;
float beachStart = max(0.0, waterLevelKm - 0.015);
float beachPeak = waterEdgeHigh;
float beachEnd = waterLevelKm + max(0.005, coastBeachWidthKm);
float coastBeach = (1.0 - smoothstep(beachPeak, beachEnd, z_pos)) * smoothstep(beachStart, beachPeak, z_pos) * gentleSlope;
float riverBeach = riverBankFac;
float beachFac = max(coastBeach, riverBeach);