A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(water): water meets the shore along a smooth line, not the zone's texel steps
yhhf248d4b5516f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 108ee6b3e..d6799c1be 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -31,6 +31,7 @@ published separately; it ships inside the editor.- **Rays against the terrain, anywhere.** `Terrains.raycast(origin, direction, maxDistance)` meets the ground's triangles exactly (the ones collision and `heightAt` use) wherever the ray goes, with no physics world and no collision tile there, for a line of sight, a pick or a landing spot.- **Far versions for generated decoration.** A recipe member can name its far version (`far`: crossed cards, or a tent for a conifer, showing a rectangle of its texture), drawn past its layer's `lodDistance`, and decoration that leans with the ground (`attach: 'align'`) now leans in its merged mesh too.- **Terrain modifiers, and zones that level their ground.** `Terrains.setModifier` lays a change over the ground (`flattenModifier` levels a circle or a turned box, blending back over its edge) that what is drawn, the queries, rays and collision all follow, remaking only the pages and collision tiles it reaches; `heightBeneathAt` reads the ground as it was made. A `WorldZone` with `flatten` levels its plot to the ground's height at its centre.+- **Water meets the shore along a smooth line.** Close up, a river's banks and the surf on a beach ran in steps a texel of the water zone wide: the baked shore distance is now stored finely near the shore (a signed square root of it), and past the shore the surf's film and the shallows' foam are told dry from wet by the picture's depth at each pixel rather than by the baked depth, which only knew whole texels.- **The distance to the shore is a distance.** Near the water's edge the baked shore distance was the water's depth (or, on land, the height above the water), so `Waters.shoreAt`, a generated world's `shoreDistance` and the surf's reach mixed heights with distances; the depth is now turned into the distance across the ground by the ground's slope there. Waves still calm as the water shallows.- **Heightmaps say how they hold their heights.** `Terrain.heightmapFormat` is Grey (the grey or red channel at the file's depth, so a 16-bit grey PNG, what terrain tools export, is read at full precision) or Red + green (sixteen bits across two 8-bit channels); the format is no longer guessed from the pixels. A heightmap that cannot be read as data says it must ship as the PNG it is. **Upgrading:** a terrain whose heightmap packs sixteen bits into red and green sets `heightmapFormat` to Red + green.- **Rivers cut their beds.** A river's `WaterBody.bedDepth` cuts its bed into the terrain, a trough under its surface with banks that blend back into the ground, laid as terrain modifiers along it so what is drawn, the queries and collision follow, and editing the spline remakes only the ground along the river.diff --git a/docs/WORLD_GENERATION_PLAN.md b/docs/WORLD_GENERATION_PLAN.mdindex 582b289c4..5cc0bd3bb 100644--- a/docs/WORLD_GENERATION_PLAN.md+++ b/docs/WORLD_GENERATION_PLAN.md@@ -93,7 +93,7 @@- 雨天/阴天时 CPU 渲染提交阻塞约 45 ms(GPU 计时或同步读回导致),需定位。- 编辑器三维视图套用后处理(天空/雾)后画面上下翻转;改动已撤回,需修呈现路径。- 河口水流纹理拉伸。-- 岸边锯齿(河岸、入海口近看时水边与冲浪白边呈台阶状):已排除区域纹理过滤与岸线距离量化(后者顺带修正:岸线距离原在岸边用垂直水深,现按地面坡度换算为水平距离,`Waters.shoreAt`/`shoreDistance` 单位因此正确);已排除地形网格与水面网格(格距改小齿距不变)。调试着色(岸线距离画成条纹)显示水面内部距离场平滑,台阶只在岸线外的冲浪薄膜与沙滩交界,齿距≈区域纹素(28000/1023≈27)。首要嫌疑:薄膜保留条件用了 8 位编码的水深通道(`u_zoneRange.w`=16 纹素,步长≈1.7 单位,缓坡上折合数十单位水平距离);修法候选:薄膜判据改用平滑的岸线距离、或水深通道提高精度(与高度同为 16 位)。+- ~~岸边锯齿~~:已修复。三处叠加:岸线距离在岸边用垂直水深(改为按坡度换算的水平距离);岸线距离 8 位线性编码在 ±3500 量程上每档约 27 单位(改为带符号平方根编码,岸边每档约 0.2 单位);冲浪薄膜与泡沫用按纹素截断的烘焙水深判断干湿(有深度缓冲时改用逐像素水柱,水深通道也改为平方根编码)。仍可见:湖口处河与湖交界有一条短横边(河道浅水与湖深水的颜色过渡),待查。- 无限地形:地貌参数(导数衰减侵蚀下呈台地状)与远处一条直线接缝需排查。- 动态分辨率在 GPU 计时下不降分辨率。- 编辑器启动时的 `NaN` CSS 高度报错(无调用栈)。diff --git a/sdk/src/water/waterShader.ts b/sdk/src/water/waterShader.tsindex e7ce4ad31..61abde193 100644--- a/sdk/src/water/waterShader.ts+++ b/sdk/src/water/waterShader.ts@@ -55,7 +55,7 @@ const WATER = `#pragma shader "Water"// than six of its cells. 0 draws every wave at every vertex.#pragma param u_cellSize float default(0) range(0,100) ui(slider)// A WaterZone's baked water (zone.ts encode): heights texel by texel (rg height over u_zoneHeight, b depth, a waves' height), field filtered-// (r shore distance, 0.5 at it; gb current; a calm share), over u_zoneRange (shore, waves, current, depth). Below the shore there is no+// (r shore distance, 0.5 at it, as a signed square root so it is fine near the shore; gb current; a calm share), over u_zoneRange (shore, waves, current, depth). Below the shore there is no// water; past the region there is the ocean where u_oceanOn says so.#pragma param u_zoneOn float default(0) range(0,1) ui(slider)#pragma param u_zoneHeights texture default(white) texel(data)@@ -131,7 +131,8 @@ vec4 waterZoneAt(vec2 p) {vec4 c = texelFetch(u_zoneHeights, i + ivec2(0, 1), 0), d = texelFetch(u_zoneHeights, i + ivec2(1, 1), 0);vec4 ha = vec4(a.r * 65280.0 + a.g * 255.0, b.r * 65280.0 + b.g * 255.0, c.r * 65280.0 + c.g * 255.0, d.r * 65280.0 + d.g * 255.0) / 65535.0;float h = mix(mix(ha.x, ha.y, t.x), mix(ha.z, ha.w, t.x), t.y);- vec2 da = mix(mix(a.ba, b.ba, t.x), mix(c.ba, d.ba, t.x), t.y);+ // The depth is stored as its square root, so the shallows (where it draws the shore) are fine: squared before blending.+ vec2 da = mix(mix(a.ba * vec2(a.b, 1.0), b.ba * vec2(b.b, 1.0), t.x), mix(c.ba * vec2(c.b, 1.0), d.ba * vec2(d.b, 1.0), t.x), t.y);// The weather (u_waveHeight) raises a body's waves only as far as the wind has room to: w is that share, and z is put so that// u_waveHeight times it is the waves' height there.float e = textureLod(u_zoneExposure, clamp(uv, 0.0, 1.0), 0.0).r;@@ -144,7 +145,8 @@ vec4 waterZoneField(vec2 p) {vec4 f = textureLod(u_zoneField, clamp(uv, 0.0, 1.0), 0.0);bool inside = all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)));if (!inside) return u_oceanOn > 0.5 ? vec4(1e6, 0.0, 0.0, 1.0) : vec4(-1.0, 0.0, 0.0, 0.0);- return vec4((f.r - 0.5) * 2.0 * u_zoneRange.x, (f.gb - 0.5) * 2.0 * u_zoneRange.z, f.a);+ float e = (f.r - 0.5) * 2.0;+ return vec4(e * abs(e) * u_zoneRange.x, (f.gb - 0.5) * 2.0 * u_zoneRange.z, f.a);}// The surf at a shore distance (waves.ts surfHeight): x its height, y how broken it is (white water on and behind a breaking crest).vec2 waterSurf(float shore, float height, float time) {@@ -210,7 +212,8 @@ fn waterZoneAt(p : vec2f) -> vec4f {let d = textureLoad(u_zoneHeights, i + vec2i(1, 1), 0);let ha = vec4f(a.r * 65280.0 + a.g * 255.0, b.r * 65280.0 + b.g * 255.0, c.r * 65280.0 + c.g * 255.0, d.r * 65280.0 + d.g * 255.0) / 65535.0;let h = mix(mix(ha.x, ha.y, t.x), mix(ha.z, ha.w, t.x), t.y);- let da = mix(mix(a.ba, b.ba, t.x), mix(c.ba, d.ba, t.x), t.y);+ // The depth is stored as its square root, so the shallows (where it draws the shore) are fine: squared before blending.+ let da = mix(mix(a.ba * vec2f(a.b, 1.0), b.ba * vec2f(b.b, 1.0), t.x), mix(c.ba * vec2f(c.b, 1.0), d.ba * vec2f(d.b, 1.0), t.x), t.y);let e = textureSampleLevel(u_zoneExposure, u_zoneExposure_s, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).r;if (!inside && mc.u_oceanOn > 0.5) { return vec4f(mc.u_oceanLevel, 1e6, mc.u_oceanWaves, 1.0); }return vec4f(mc.u_zoneHeight.x + h * mc.u_zoneHeight.y, da.x * mc.u_zoneRange.w,@@ -224,7 +227,8 @@ fn waterZoneField(p : vec2f) -> vec4f {if (mc.u_oceanOn > 0.5) { return vec4f(1e6, 0.0, 0.0, 1.0); }return vec4f(-1.0, 0.0, 0.0, 0.0);}- return vec4f((f.r - 0.5) * 2.0 * mc.u_zoneRange.x, (f.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z, f.a);+ let e = (f.r - 0.5) * 2.0;+ return vec4f(e * abs(e) * mc.u_zoneRange.x, (f.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z, f.a);}fn waterSurf(shore : f32, height : f32, time : f32) -> vec2f {if (height <= 0.0 || mc.u_surfLength <= 0.0) { return vec2f(0.0); }@@ -382,7 +386,8 @@ vec4 waterZoneAt(vec2 p) {vec4 c = texelFetch(u_zoneHeights, i + ivec2(0, 1), 0), d = texelFetch(u_zoneHeights, i + ivec2(1, 1), 0);vec4 ha = vec4(a.r * 65280.0 + a.g * 255.0, b.r * 65280.0 + b.g * 255.0, c.r * 65280.0 + c.g * 255.0, d.r * 65280.0 + d.g * 255.0) / 65535.0;float h = mix(mix(ha.x, ha.y, t.x), mix(ha.z, ha.w, t.x), t.y);- vec2 da = mix(mix(a.ba, b.ba, t.x), mix(c.ba, d.ba, t.x), t.y);+ // The depth is stored as its square root, so the shallows (where it draws the shore) are fine: squared before blending.+ vec2 da = mix(mix(a.ba * vec2(a.b, 1.0), b.ba * vec2(b.b, 1.0), t.x), mix(c.ba * vec2(c.b, 1.0), d.ba * vec2(d.b, 1.0), t.x), t.y);// The weather (u_waveHeight) raises a body's waves only as far as the wind has room to: w is that share, and z is put so that// u_waveHeight times it is the waves' height there.float e = textureLod(u_zoneExposure, clamp(uv, 0.0, 1.0), 0.0).r;@@ -395,7 +400,8 @@ vec4 waterZoneField(vec2 p) {vec4 f = textureLod(u_zoneField, clamp(uv, 0.0, 1.0), 0.0);bool inside = all(greaterThanEqual(uv, vec2(0.0))) && all(lessThanEqual(uv, vec2(1.0)));if (!inside) return u_oceanOn > 0.5 ? vec4(1e6, 0.0, 0.0, 1.0) : vec4(-1.0, 0.0, 0.0, 0.0);- return vec4((f.r - 0.5) * 2.0 * u_zoneRange.x, (f.gb - 0.5) * 2.0 * u_zoneRange.z, f.a);+ float e = (f.r - 0.5) * 2.0;+ return vec4(e * abs(e) * u_zoneRange.x, (f.gb - 0.5) * 2.0 * u_zoneRange.z, f.a);}// The surf at a shore distance (waves.ts surfHeight): x its height, y how broken it is (white water on and behind a breaking crest).vec2 waterSurf(float shore, float height, float time) {@@ -502,7 +508,8 @@ void main() {vec4 zone = waterZoneAt(wp);bool zoneIn = all(greaterThanEqual(zoneUv, vec2(0.0))) && all(lessThanEqual(zoneUv, vec2(1.0)));bool zoneOn = u_zoneOn > 0.5 && u_waveSpace > 0.5;- float shoreDist = !zoneOn ? 1e6 : zoneIn ? (zoneTex.r - 0.5) * 2.0 * u_zoneRange.x : u_oceanOn > 0.5 ? 1e6 : -1.0;+ float shoreE = (zoneTex.r - 0.5) * 2.0;+ float shoreDist = !zoneOn ? 1e6 : zoneIn ? shoreE * abs(shoreE) * u_zoneRange.x : u_oceanOn > 0.5 ? 1e6 : -1.0;float shoreDepth = zoneOn ? zone.y : 1e6;// How high the waves stand (a multiple of u_waveHeight), and the share of them kept toward the shore, which calms the small ripples and the crests too.float calm = !zoneOn ? 1.0 : zoneIn ? zoneTex.a : 1.0;@@ -624,7 +631,9 @@ void main() {float shore = haveDepth && u_foamWidth > 0.0 ? clamp((1.0 - vertical / (u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0) : 0.0;// The baked shore foams too, where the depth buffer cannot say (no chain, no float targets) and along the outline the zone traced.if (zoneOn && u_foamWidth > 0.0) {- shore = max(shore, clamp((1.0 - min(shoreDist, shoreDepth) / (u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0));+ // With the picture's depth the shallows foam by it, pixel by pixel; the baked depth then adds only the traced outline, not its texels.+ float baked = haveDepth ? shoreDist : min(shoreDist, shoreDepth);+ shore = max(shore, clamp((1.0 - baked / (u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0));}float onCrest = u_foamCrest > 0.0 ? smoothstep(1.0 - 0.3 * u_foamCrest, 1.0, crest) * smoothstep(0.35, 0.75, breakup) : 0.0;float surfFoam = surf.y * smoothstep(0.15, 0.6, breakup + surf.y * 0.4);@@ -670,7 +679,10 @@ void main() {// Past the shore only the surf's film is water: over ground no lower than the water, within its height of the rest level (further off// it is the mesh stretched between two waters' heights); the depth test cuts it where the ground rises above it.bool film = abs(P.y - zone.x) <= surf.x + u_waveHeight * zone.z + 1e-3;- if (shoreDist < 0.0 && (surf.x <= 0.0 || shoreDepth > 1e-3 || !film)) discard;+ // Ground lower than the water there (a dry basin) takes no film. The picture's depth says it of this very pixel; the baked depth only+ // of whole texels (dry is 0 and any wet one beside it raises the blend), which would cut the film in the texels' steps.+ float under = haveDepth ? column0 * abs(viewDir.y) - 2.0 * (surf.x + u_waveHeight * zone.z) - 1.0 : shoreDepth - 1e-3;+ if (shoreDist < 0.0 && (surf.x <= 0.0 || under > 0.0 || !film)) discard;fragColor = vec4(color, haveColor ? 1.0 : 0.85);#ifdef ES_GBUFFER// 0.72: a surface, and water (see readSurface): what lands on it is the water's, not a wet floor's.@@ -793,7 +805,8 @@ fn waterZoneAt(p : vec2f) -> vec4f {let d = textureLoad(u_zoneHeights, i + vec2i(1, 1), 0);let ha = vec4f(a.r * 65280.0 + a.g * 255.0, b.r * 65280.0 + b.g * 255.0, c.r * 65280.0 + c.g * 255.0, d.r * 65280.0 + d.g * 255.0) / 65535.0;let h = mix(mix(ha.x, ha.y, t.x), mix(ha.z, ha.w, t.x), t.y);- let da = mix(mix(a.ba, b.ba, t.x), mix(c.ba, d.ba, t.x), t.y);+ // The depth is stored as its square root, so the shallows (where it draws the shore) are fine: squared before blending.+ let da = mix(mix(a.ba * vec2f(a.b, 1.0), b.ba * vec2f(b.b, 1.0), t.x), mix(c.ba * vec2f(c.b, 1.0), d.ba * vec2f(d.b, 1.0), t.x), t.y);let e = textureSampleLevel(u_zoneExposure, u_zoneExposure_s, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).r;if (!inside && mc.u_oceanOn > 0.5) { return vec4f(mc.u_oceanLevel, 1e6, mc.u_oceanWaves, 1.0); }return vec4f(mc.u_zoneHeight.x + h * mc.u_zoneHeight.y, da.x * mc.u_zoneRange.w,@@ -807,7 +820,8 @@ fn waterZoneField(p : vec2f) -> vec4f {if (mc.u_oceanOn > 0.5) { return vec4f(1e6, 0.0, 0.0, 1.0); }return vec4f(-1.0, 0.0, 0.0, 0.0);}- return vec4f((f.r - 0.5) * 2.0 * mc.u_zoneRange.x, (f.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z, f.a);+ let e = (f.r - 0.5) * 2.0;+ return vec4f(e * abs(e) * mc.u_zoneRange.x, (f.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z, f.a);}fn waterSurf(shore : f32, height : f32, time : f32) -> vec2f {if (height <= 0.0 || mc.u_surfLength <= 0.0) { return vec2f(0.0); }@@ -926,7 +940,7 @@ fn waterSurface(p : vec2f, time : f32, dist : f32, amp : f32, calm : f32) -> vecvar flow = vec2f(0.0);if (zoneOn) {shoreDepth = zone.y;- if (zoneIn) { shoreDist = (zoneTex.r - 0.5) * 2.0 * mc.u_zoneRange.x; flow = (zoneTex.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z; calm = zoneTex.a; }+ if (zoneIn) { let shoreE = (zoneTex.r - 0.5) * 2.0; shoreDist = shoreE * abs(shoreE) * mc.u_zoneRange.x; flow = (zoneTex.gb - vec2f(0.5)) * 2.0 * mc.u_zoneRange.z; calm = zoneTex.a; }else if (mc.u_oceanOn < 0.5) { shoreDist = -1.0; }damp = zone.z * calm;}@@ -1035,7 +1049,10 @@ fn waterSurface(p : vec2f, time : f32, dist : f32, amp : f32, calm : f32) -> vecvar shore = 0.0;if (haveDepth && mc.u_foamWidth > 0.0) { shore = clamp((1.0 - vertical / (mc.u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0); }if (zoneOn && mc.u_foamWidth > 0.0) {- shore = max(shore, clamp((1.0 - min(shoreDist, shoreDepth) / (mc.u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0));+ // With the picture's depth the shallows foam by it, pixel by pixel; the baked depth then adds only the traced outline, not its texels.+ var baked = min(shoreDist, shoreDepth);+ if (haveDepth) { baked = shoreDist; }+ shore = max(shore, clamp((1.0 - baked / (mc.u_foamWidth * pulse)) * 1.25 - breakup * 1.15, 0.0, 1.0));}var onCrest = 0.0;if (mc.u_foamCrest > 0.0) { onCrest = smoothstep(1.0 - 0.3 * mc.u_foamCrest, 1.0, waves.crest) * smoothstep(0.35, 0.75, breakup); }@@ -1074,7 +1091,11 @@ fn waterSurface(p : vec2f, time : f32, dist : f32, amp : f32, calm : f32) -> vecvar alpha = 0.85;if (haveColor) { alpha = 1.0; }let film = abs(P.y - zone.x) <= surf.x + mc.u_waveHeight * zone.z + 1e-3;- if (shoreDist < 0.0 && (surf.x <= 0.0 || shoreDepth > 1e-3 || !film)) { discard; }+ // Ground lower than the water there (a dry basin) takes no film. The picture's depth says it of this very pixel; the baked depth only+ // of whole texels (dry is 0 and any wet one beside it raises the blend), which would cut the film in the texels' steps.+ var under = shoreDepth - 1e-3;+ if (haveDepth) { under = column0 * abs(viewDir.y) - 2.0 * (surf.x + mc.u_waveHeight * zone.z) - 1.0; }+ if (shoreDist < 0.0 && (surf.x <= 0.0 || under > 0.0 || !film)) { discard; }#ifdef ES_GBUFFERvar frag : FragOut;frag.color = vec4f(color, alpha);diff --git a/sdk/src/water/zone.ts b/sdk/src/water/zone.tsindex a92228530..d56d1f37d 100644--- a/sdk/src/water/zone.ts+++ b/sdk/src/water/zone.ts@@ -339,7 +339,7 @@ export class WaterField {/*** The field as two RGBA8 images, rows from minZ. heights (read texel by texel: filtered bytes are no number): rg the height, high byte- * first; b the depth; a the swell (the body's waves' height). field (filtered): r the shore distance (0.5 at it); gb the current (0.5 still); a the calm.+ * first; b the depth, as its square root (fine where the water is shallow, where the shore is drawn by it); a the swell (the body's waves' height). field (filtered): r the shore distance (0.5 at it, a signed square root); gb the current (0.5 still); a the calm.* exposure (filtered): r how open the water is to the wind. Each over its range in `r`.*/encode(r: ZoneRanges): { heights: Uint8Array; field: Uint8Array; exposure: Uint8Array } {@@ -350,9 +350,11 @@ export class WaterField {const h = Math.round(Math.min(Math.max((this.height[k]! - r.heightMin) / r.heightSpan, 0), 1) * 65535);heights[k * 4] = h >> 8;heights[k * 4 + 1] = h & 255;- heights[k * 4 + 2] = byte(this.depth[k]! / r.depth);+ heights[k * 4 + 2] = byte(Math.sqrt(Math.max(this.depth[k]! / r.depth, 0)));heights[k * 4 + 3] = byte(this.swell[k]! / r.amp);- field[k * 4] = byte(this.shore[k]! / (2 * r.shore) + 0.5);+ // As a signed square root: a byte across the whole reach of the surf is coarse, and the shore is drawn where it crosses zero.+ const across = Math.max(Math.min(this.shore[k]! / r.shore, 1), -1);+ field[k * 4] = byte(Math.sign(across) * Math.sqrt(Math.abs(across)) / 2 + 0.5);field[k * 4 + 1] = byte(this.flowX[k]! / (2 * r.flow) + 0.5);field[k * 4 + 2] = byte(this.flowZ[k]! / (2 * r.flow) + 0.5);field[k * 4 + 3] = byte(this.calm[k]!);diff --git a/sdk/tests/water-zone.test.ts b/sdk/tests/water-zone.test.tsindex 37d0dc0c2..e1879895a 100644--- a/sdk/tests/water-zone.test.ts+++ b/sdk/tests/water-zone.test.ts@@ -132,7 +132,9 @@ describe('the field as the shader reads it', () => {const h = r.heightMin + ((heights[k * 4]! * 256 + heights[k * 4 + 1]!) / 65535) * r.heightSpan;expect(h).toBeCloseTo(field.height[k]!, 3);expect((rest[k * 4 + 1]! / 255 - 0.5) * 2 * r.flow).toBeCloseTo(field.flowX[k]!, 1);- expect((rest[k * 4]! / 255 - 0.5) * 2 * r.shore).toBeCloseTo(Math.max(-r.shore, Math.min(r.shore, field.shore[k]!)), 0);+ // The shore as a signed square root: squared back, it is within a byte's step there (finer the nearer the shore).+ const e = (rest[k * 4]! / 255 - 0.5) * 2, want = Math.max(-r.shore, Math.min(r.shore, field.shore[k]!));+ expect(Math.abs(e * Math.abs(e) * r.shore - want)).toBeLessThanOrEqual(r.shore * (2 * Math.sqrt(Math.abs(want) / r.shore) / 255 + 1 / 65025) + 1e-6);});it('is nothing over an ocean alone: there is no region, and every point is the ocean', () => {diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 195a641fe..8d4d7e2f8 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -2810,4 +2810,6 @@ export const NOTED = {{"note":"Heightmaps say how they hold their heights."},"fix(water): the shore distance near the edge is a distance across the ground, not the water's depth":{"note":"The distance to the shore is a distance."},+ "fix(water): water meets the shore along a smooth line, not the zone's texel steps":+ {"note":"Water meets the shore along a smooth line."},};