fix(client): remove biome-border seams and in-biome variant banding (#200, #201) #202

Merged
marco merged 3 commits from fix/biome-seams into main 2026-07-25 18:33:13 +02:00
Collaborator

Fixes the two ground-rendering defects reported on the biome map: the coloured seam at biome borders (#200) and the square diamond banding inside a biome (#201).

#200 — biome-border seam

Two independent causes, both fixed:

  • Soft-blend seam. The dual grid draws the lowest-priority corner biome as a full base tile and paints higher biomes over it. With the mask edge a wide soft ramp, every partially-transparent pixel was a mix of the two biomes — a third colour that reads as a line wherever the pair contrasts (bright savanna under dark marsh). The mask edge is now essentially binary, with the organic irregularity coming from the noise perturbing the threshold, not a soft ramp (scripts/genmasks.py: SOFT 0.18 → 0.015, noise up). The mask overlap was also sized in mask pixels (2px on a 128px mask → ~0.7px at the 44px tile), so it didn't survive the downscale; it's now ~3px at tile resolution.
  • Bilinear edge bleed. The world pass used the default LinearClamp sampler; with the camera at sub-pixel offsets, bilinear sampling bled across each ground diamond's alpha edge, drawing a faint regular diagonal grid over the whole ground. Switched the ground/world pass to PointClamp — crisp texel edges, no bleed, and the right choice for this pixel art anyway.

seam fixed

#201 — diamond banding inside a biome

Each cell drew its chosen variant as a hard-edged diamond, so adjacent different-variant cells showed a hard diamond seam and, over a region, a blocky patchwork. The dual grid already smooths biome borders; this applies the same mechanism to a biome's own variants.

  • The masked tiles are now baked per (biome, variant), not just variant 0 (a one-time client-side bake at load — no per-frame cost).
  • DrawDualTile orders the four corners by a composite key biomePriority * 16 + variant, so a variant boundary layers and curves exactly like a biome boundary. The per-cell horizontal flip was dropped: a cell must look identical whether it is a dual tile's base or another's masked overlay, or the two wouldn't blend.
  • Also tone-matched each biome's four variants toward a common mean luminance, so the blend has no residual brightness step (tundra especially, whose variants spanned 166–211).

variant banding fixed

How it was tested

  • Whole solution builds 0 warnings; all tests green (7/7 projects). GroundTileSelector/DualGrid/LandVariantKeys units unaffected (the selection contract is unchanged; only the renderer's consumption changed).
  • Verified in the client on a fresh DB at the same marsh/savanna border and a savanna/desert interior (before/after above).
Fixes the two ground-rendering defects reported on the biome map: the coloured **seam at biome borders** (#200) and the **square diamond banding inside a biome** (#201). ## #200 — biome-border seam Two independent causes, both fixed: - **Soft-blend seam.** The dual grid draws the lowest-priority corner biome as a full base tile and paints higher biomes over it. With the mask edge a wide soft ramp, every partially-transparent pixel was a *mix* of the two biomes — a third colour that reads as a line wherever the pair contrasts (bright savanna under dark marsh). The mask edge is now essentially **binary**, with the organic irregularity coming from the noise perturbing the threshold, not a soft ramp (`scripts/genmasks.py`: `SOFT` 0.18 → 0.015, noise up). The mask overlap was also sized in mask pixels (2px on a 128px mask → ~0.7px at the 44px tile), so it didn't survive the downscale; it's now ~3px at tile resolution. - **Bilinear edge bleed.** The world pass used the default `LinearClamp` sampler; with the camera at sub-pixel offsets, bilinear sampling bled across each ground diamond's alpha edge, drawing a faint regular diagonal grid over the whole ground. Switched the ground/world pass to **`PointClamp`** — crisp texel edges, no bleed, and the right choice for this pixel art anyway. ![seam fixed](https://git.homelab.devncode.it/attachments/17623d50-7ded-4215-b1d7-9080dc91d38b) ## #201 — diamond banding inside a biome Each cell drew its chosen variant as a **hard-edged diamond**, so adjacent different-variant cells showed a hard diamond seam and, over a region, a blocky patchwork. The dual grid already smooths biome borders; this applies the **same mechanism to a biome's own variants**. - The masked tiles are now baked **per (biome, variant)**, not just variant 0 (a one-time client-side bake at load — no per-frame cost). - `DrawDualTile` orders the four corners by a **composite key** `biomePriority * 16 + variant`, so a variant boundary layers and curves exactly like a biome boundary. The per-cell horizontal flip was dropped: a cell must look identical whether it is a dual tile's base or another's masked overlay, or the two wouldn't blend. - Also **tone-matched** each biome's four variants toward a common mean luminance, so the blend has no residual brightness step (tundra especially, whose variants spanned 166–211). ![variant banding fixed](https://git.homelab.devncode.it/attachments/66383563-a4ac-48dc-a847-4bd70d21a4aa) ## How it was tested - Whole solution builds **0 warnings**; all tests green (7/7 projects). `GroundTileSelector`/`DualGrid`/`LandVariantKeys` units unaffected (the selection contract is unchanged; only the renderer's consumption changed). - Verified in the client on a fresh DB at the same marsh/savanna border and a savanna/desert interior (before/after above).
Merge remote-tracking branch 'origin/main' into fix/biome-seams
All checks were successful
ci / Lua content lint (pull_request) Successful in 17s
ci / Lint & Test (pull_request) Successful in 12m45s
adabba753f
# Conflicts:
#	client/IsoMmo.Client/assets/assets.isoa
Owner

Rebased onto main and rebuilt assets.isoa via just pack so the pack carries BOTH the #184 biome props AND this branch's binary masks + tone-matched variants (the earlier binary conflict was the two packs diverging on different content). Verified: whole solution builds 0 warnings, all tests green, and screenshots from a fresh DB show clean curved biome borders (grass/dry/rock triple border) with no coloured seam and no in-biome diamond banding.

Rebased onto main and rebuilt `assets.isoa` via `just pack` so the pack carries BOTH the #184 biome props AND this branch's binary masks + tone-matched variants (the earlier binary conflict was the two packs diverging on different content). Verified: whole solution builds 0 warnings, all tests green, and screenshots from a fresh DB show clean curved biome borders (grass/dry/rock triple border) with no coloured seam and no in-biome diamond banding.
marco approved these changes 2026-07-25 18:33:10 +02:00
marco left a comment

Code correct: composite key drives DualGrid (comparisons only), base/overlay un-flipped so same-variant blends, per-variant bake bounded, PointClamp fixes bilinear bleed. Conflict was assets.isoa (binary) — resolved by canonical repack. CI green, screenshots verified.

Code correct: composite key drives DualGrid (comparisons only), base/overlay un-flipped so same-variant blends, per-variant bake bounded, PointClamp fixes bilinear bleed. Conflict was assets.isoa (binary) — resolved by canonical repack. CI green, screenshots verified.
marco merged commit dc0b132bc6 into main 2026-07-25 18:33:13 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marco/IsoMmo!202
No description provided.