ZEROFAMILY · STRUCTURE MASK SUBSYSTEM

Zero
Structure
Mask

Deterministic void-pocket system for infinite 3D procedural worlds.
O(1) per cell. No stored world state. Zero bytes describe infinity.

ZEROBYTES ZERO-FIELD KOCH MEGASTRUCTURE V3 GLB/GLTF READY WORLD SEED 0x4B4F4348
01 · OVERVIEW

Punch holes
into infinity

The Koch Megastructure generates an infinite interior world from a single seed — no stored maps, no chunk files. But to place a large Point of Interest (a city gate, a reactor core, a transit hub), you need empty space that the topology won't fill in.

ZeroStructureMask punches void pockets into the megastructure at registered coordinates. Any cell within the pocket radius suppresses its Koch panel generation. The anchor cell at the centre renders a diamond BSP placeholder — or a real .glb / .gltf model when one is provided.

The system is a pure drop-in: it wraps buildCellMesh with an early-exit guard and adds a second draw pass for placeholders. No existing functions are modified.

TOP-DOWN Y=0 SLICE · 9×9 VIEW
KOCH SOLID
VOID POCKET
BOUNDARY
ANCHOR
O(1) PER CELL
Any cell coordinate returns its mask state in constant time. No spatial queries, no quadtrees, no stored world maps.
ANCHOR PLACEHOLDER
The anchor cell renders a large octahedron BSP diamond in amber. Replaced by a real .glb model when provided — the void pocket remains active either way.
BOUNDARY BLEND
Cells at the pocket edge receive a smoothstep displacement ramp — Koch panels fade out gracefully rather than cutting hard at a voxel boundary.
INFINITE SCALE
Sites are just integers in an array. Anchor positions can be anywhere in the infinite 3D lattice. The system is as unbounded as the world itself.

Place sites,
watch the void open

Left-click to place a Structure Site. Click an existing anchor to remove it. Drag right-click to pan. Scroll to zoom. Use the Y Slice slider to travel through layers.

CONTROLS

LMB Place structure site at cell. Click existing anchor to remove.
RMB DRAG Pan the view through the infinite grid.
SCROLL Zoom in/out. Zoom in to see boundary blend zones and labels.

SLIDERS

Y SLICE Move through the Y axis of the 3D lattice. Pocket disappears outside radiusY.
RADIUS XZ Horizontal void half-extent in cells. Applied to new sites placed after changing.
RADIUS Y Vertical void half-extent. Set to 0 for a single-layer mask.
◈ — ANCHOR CELL
░ — VOID POCKET
▒ — BLEND BOUNDARY
█ — KOCH SOLID
03 · ALGORITHM

How the mask query
works

For every cell coordinate (cx, cy, cz) queried during the Koch mesh build, the mask runs a linear scan over STRUCTURE_SITES[]. For each site, axis-aligned Chebyshev distance is computed and compared to the site's radius.

Three outcomes are possible: the cell is normal (no mask, build Koch geometry as usual), a pocket cell (fully suppressed, return empty mesh), or a boundary cell (Koch panels scaled down by a smoothstep ramp to blend the edge).

The anchor cell — at distance 0 from the site — is always empty and triggers a placeholder diamond draw in a separate render pass.

MASK QUERY · querySiteMask(cx, cy, cz)
for (site of STRUCTURE_SITES) {
  dx = |cx - site.cx|
  dy = |cy - site.cy|
  dz = |cz - site.cz|

  if (dx ≤ radiusX AND
      dy ≤ radiusY AND
      dz ≤ radiusZ) {

    // Chebyshev dist → smoothstep blend
    blend = max(dx/rx, dy/ry, dz/rz)
    t     = smoothstep(blend)

    return {
      masked: true,
      isAnchor: (dx=0 AND dy=0 AND dz=0),
      blend: t
    }
  }
}
return { masked: false }
buildCellMesh(cx, cy, cz, lod) │ ├─ querySiteMask(cx, cy, cz) │ │ │ ├─ masked = false ──────────────────── ► build Koch geometry normally │ │ │ ├─ isAnchor = true ──────────────────── ► return Float32Array(0) │ │ placeholder drawn separately │ │ │ └─ pocket / boundary cell │ │ │ ├─ blend < 0.85 ────────────────── ► return Float32Array(0) [void] │ │ │ └─ blend 0.85–1.0 ────────────── ► build Koch, scale kochD() by blend panels fade to 0 at boundary │ └─ Upload to GPU cache, draw arrays ─ separate pass ───────────────────────────────────────────────────────── renderSiteLayer() │ └─ for each site in STRUCTURE_SITES: ├─ distance cull (skip if outside draw range) ├─ modelLoaded? → skip placeholder, draw GLB instead └─ draw octahedron (amber rim shader, pulse glow, quartic fog)
04 · INTEGRATION

Five points,
no rewrites

ZeroStructureMask is inserted at five precise locations in KochMegastructureV3.jsx. No existing function bodies need to be altered — only wrapped or extended.

STRUCTURE_SITES Registry

Insert the site array and querySiteMask() immediately after the existing constants block (BIOME_PROPS). Each site specifies its cell coordinate, axis radii, an optional model URL, and a display label.

SITE SCHEMA
{ id: 0, cx: 4, cy: 0, cz: 4,
  radiusX: 2, radiusY: 1, radiusZ: 2,
  modelUrl: null,  // or '/models/nexus.glb'
  label: 'NEXUS GATE ALPHA' }

buildCellMesh Guard

Add an early-exit block at the very top of buildCellMesh. Anchors and deep pocket cells return Float32Array(0) immediately. Boundary cells derive a _maskScale value that is multiplied against every kochD() displacement call later in the function.

buildAnchorMesh + Shader

A new function builds a flat-shaded regular octahedron using the existing STRIDE/CELL constants. A second minimal WebGL shader (ANCHOR_VS / ANCHOR_FS) renders it with amber rim lighting and a slow pulse uniform. Buffers are cached in anchorCache keyed by site ID.

Frame Loop — Second Draw Pass

After the Koch cell draw loop, a short loop over STRUCTURE_SITES distance-culls each site and draws its anchor buffer. The main Koch shader is restored afterwards with gl.useProgram(prog).

HUD + Cleanup

Two new HUD lines show total site count and nearest site label. When the camera is inside a mask zone, the biome line flips to amber and displays the site label. Anchor buffers are deleted in the existing teardown return.

05 · DATA FORMAT

Site registry
reference

The full site registry is a plain JavaScript array — no database, no binary format, no file IO. It lives as a constant in the component body and is evaluated once at mount.

Sites can be authored by hand, generated procedurally from a secondary ZeroBytes pass, or exported from the ProceduralTerrain Structure Layer editor and ingested here.

FIELD REFERENCE
FIELD TYPE PURPOSE
id number Unique integer, used as GL buffer cache key
cx, cy, cz number Anchor cell coordinate (integer, any range)
radiusX/Y/Z number Void half-extents in cells per axis
modelUrl string|null Path to .glb/.gltf; null shows placeholder
label string Display name, shown in HUD and on anchor
STRUCTURE_SITES · COMPLETE EXAMPLE
const STRUCTURE_SITES = [
  {
    id: 0,
    cx: 4,  cy: 0,  cz: 4,
    radiusX: 2,
    radiusY: 1,
    radiusZ: 2,
    modelUrl: null,
    label: 'NEXUS GATE ALPHA',
  },
  {
    id: 1,
    cx: -6, cy: 1,  cz: 2,
    radiusX: 2,
    radiusY: 1,
    radiusZ: 2,
    modelUrl: '/models/shard.glb',
    label: 'TRANSIT SHARD BETA',
  },
  {
    id: 2,
    cx: 0,  cy: -1, cz: -8,
    radiusX: 3,   // larger site
    radiusY: 2,
    radiusZ: 3,
    modelUrl: null,
    label: 'CATHEDRAL VOID',
  },
];
NOTE · WORLD UNITS
Cell coordinates are in cell-space, not world-space. World position = cx × STRIDE where STRIDE = CELL + GAP = 608u. The anchor mesh is automatically centred at cx×608 + 256.