BlueGit

timfa questward

Fix water atlas seams: drop per-tile mirrorY.

Paired tile+atlas mirrorY put holes on the right side but inverted puv vs
u_tileY inside each cell, seaming the FBM field. Keep only atlas GameObject
mirrorY so N/S placement stays correct and noise stays continuous.

timfa Tim Falken · pushed by timfa

Authored 2026-09-13 · 2 months ago

Hash
7dce801a5f2f092f1655791eda2a0ee3fc93b0dd
Parent
b1fcdd5d
2 files changed +7 −7
client/src/render/fluidChunkAtlas.js +5 −5
@@ -2,8 +2,9 @@
2 2 * Per-chunk fluid (water / lava) atlas: render procedural shaders at true
3 3 * SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.
4 4 *
5 * Tile placement is Y-down (localY). FBO↔sprite V mismatch is corrected by
6 * mirrorY on each tile draw and on the atlas GameObject (holes + coasts).
5 * Tile placement is Y-down (localY), content upright (no per-tile mirrorY —
6 * that breaks world-space noise continuity / seams). FBO↔sprite V mismatch
7 * is corrected only by mirrorY on the atlas GameObject.
7 8 */
8 9
9 10 import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
@@ -160,9 +161,8 @@ export function drawFluidAtlasTile (glCtx, {
160 161 h: SPRITE_SIZE_PX,
161 162 rotationDeg: 0,
162 163 mirrorX: false,
163 // FBO sampling is V-flipped vs Framework sprites; pre-flip tile content
164 // so a mirrored atlas GameObject shows correct coasts + hole positions.
165 mirrorY: true,
164 // Do not mirrorY per tile — inverts puv vs u_tileY and seams the FBM field.
165 mirrorY: false,
166 166 alpha: 1,
167 167 uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },
168 168 shader,
@@ -2,8 +2,9 @@
2 * Per-chunk fluid (water / lava) atlas: render procedural shaders at true
2 * Per-chunk fluid (water / lava) atlas: render procedural shaders at true
3 * SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.
3 * SPRITE_SIZE_PX, then nearest-upscale the atlas to chunk world size.
4 *
4 *
5 * Tile placement is Y-down (localY). FBO↔sprite V mismatch is corrected by
5 * Tile placement is Y-down (localY), content upright (no per-tile mirrorY —
6 * mirrorY on each tile draw and on the atlas GameObject (holes + coasts).
6 * that breaks world-space noise continuity / seams). FBO↔sprite V mismatch
7 * is corrected only by mirrorY on the atlas GameObject.
7 */
8 */
8
9
9import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
10import { CHUNK_SIZE, SPRITE_SIZE_PX } from "/shared/protocol/constants.js";
@@ -160,9 +161,8 @@ export function drawFluidAtlasTile (glCtx, {
160 h: SPRITE_SIZE_PX,
161 h: SPRITE_SIZE_PX,
161 rotationDeg: 0,
162 rotationDeg: 0,
162 mirrorX: false,
163 mirrorX: false,
163 // FBO sampling is V-flipped vs Framework sprites; pre-flip tile content
164 // Do not mirrorY per tile — inverts puv vs u_tileY and seams the FBM field.
164 // so a mirrored atlas GameObject shows correct coasts + hole positions.
165 mirrorY: false,
165 mirrorY: true,
166 alpha: 1,
166 alpha: 1,
167 uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },
167 uvRect: uvRect ?? { u0: 0, v0: 0, u1: 1, v1: 1 },
168 shader,
168 shader,
client/src/render/worldView.js +2 −2
@@ -4446,8 +4446,8 @@ export class WorldView
4446 4446 object.transform.position.x = Math.round(left + chunkPx / 2);
4447 4447 object.transform.position.y = Math.round(top + chunkPx / 2);
4448 4448 object.transform.size = new vector(chunkPx, chunkPx);
4449 // FBO color attachment is V-flipped vs Framework sprite UVs — mirror so
4450 // sandbank holes sit on the correct N/S side (tile draws also mirrorY).
4449 // FBO color attachment is V-flipped vs Framework sprite UVs — one atlas
4450 // mirrorY restores N/S hole placement without breaking noise continuity.
4451 4451 if (object.renderer)
4452 4452 { object.renderer.mirrorY = true; }
4453 4453 if (kind === "bloom")
@@ -4446,8 +4446,8 @@ export class WorldView
4446 object.transform.position.x = Math.round(left + chunkPx / 2);
4446 object.transform.position.x = Math.round(left + chunkPx / 2);
4447 object.transform.position.y = Math.round(top + chunkPx / 2);
4447 object.transform.position.y = Math.round(top + chunkPx / 2);
4448 object.transform.size = new vector(chunkPx, chunkPx);
4448 object.transform.size = new vector(chunkPx, chunkPx);
4449 // FBO color attachment is V-flipped vs Framework sprite UVs — mirror so
4449 // FBO color attachment is V-flipped vs Framework sprite UVs — one atlas
4450 // sandbank holes sit on the correct N/S side (tile draws also mirrorY).
4450 // mirrorY restores N/S hole placement without breaking noise continuity.
4451 if (object.renderer)
4451 if (object.renderer)
4452 { object.renderer.mirrorY = true; }
4452 { object.renderer.mirrorY = true; }
4453 if (kind === "bloom")
4453 if (kind === "bloom")