Toroidal periodic textures, dual-basis ground alignment, and footpoint-anchored facade shear

Why Sliced Panoramas Break Modular 2.5D Assembly

Slicing a single wide generative image into reusable 2.5D isometric tiles usually breaks along three seams at once: visible boundary jumps, mismatched ground-grid angles relative to navigation axes, and leaning walls once the ground plane is rescaled. Separating periodic textures, ground-basis alignment, footpoint-anchored facade shear, and port contracts keeps each geometric constraint orthogonal.

Under orthographic / weak-perspective projection with world ground coordinates (u,v)(u, v) and elevation zz, screen coordinates satisfy:

p=p0+u bu+v bv+z bzp = p_0 + u\,b_u + v\,b_v + z\,b_z

where (bu,bv,bz)(b_u, b_v, b_z) jointly govern tile tessellation, movement directions, and depth sorting.

4D Torus Embedding for C∞C^\infty Tileable Procedural Textures

To make an W×HW \times H procedural texture match both values and derivatives across opposite edges without post-hoc edge blurring, map (x,y)(x, y) onto a 4D torus T2⊂R4\mathbb{T}^2 \subset \mathbb{R}^4 before evaluating smooth 4D noise NN:

θx=2πxW,θy=2πyH\theta_x = \frac{2\pi x}{W}, \qquad \theta_y = \frac{2\pi y}{H} Φ(x,y)=(rxcos⁡θx,  rxsin⁡θx,  rycos⁡θy,  rysin⁡θy),T(x,y)=N(Φ(x,y))\Phi(x, y) = \big(r_x\cos\theta_x,\; r_x\sin\theta_x,\; r_y\cos\theta_y,\; r_y\sin\theta_y\big), \qquad T(x, y) = N(\Phi(x, y))

Keeping both (cos⁡,sin⁡)(\cos, \sin) preserves phase orientation (using cos⁡θ\cos\theta alone creates mirror-symmetry creases), and setting rx/W=ry/Hr_x / W = r_y / H equalizes spatial frequency along both axes. For existing bitmap seams, a raised-cosine blend α(s)=12(1−cos⁡(πs/w))\alpha(s) = \frac{1}{2}(1 - \cos(\pi s / w)) zeroes endpoint slope discontinuities.

Dual-Basis Ground Calibration & Footpoint-Anchored Shear

Given measured source ground axes B=[bu    bv]B = [b_u\;\; b_v] and target engine tile axes B0B_0 (e.g. mapping (64,32)⊤,(−64,32)⊤(64, 32)^\top, (-64, 32)^\top onto dimetric (64,24)⊤,(−64,24)⊤(64, 24)^\top, (-64, 24)^\top), the ground layer transforms via A=B0B−1A = B_0 B^{-1}:

q=q0+A(p−p0)q = q_0 + A(p - p_0)

Because A∈R2×2A \in \mathbb{R}^{2\times 2} has only four degrees of freedom, fixing (bu,bv)(b_u, b_v) leaves no freedom to preserve the vertical axis bzb_z. Applying AA to foreground props tilts vertical walls. Instead, isolate facade/prop layers and anchor the shear at the ground contact footpoint (x0,y0)(x_0, y_0), mapping the measured base-to-top vector v=(vx,vy)v = (v_x, v_y) onto true screen vertical (0,h)(0, h):

[x′y′]=[x0y0]+[1−vx/vy0h/vy][x−x0y−y0]\begin{bmatrix} x' \\ y' \end{bmatrix} = \begin{bmatrix} x_0 \\ y_0 \end{bmatrix} + \begin{bmatrix} 1 & -v_x / v_y \\ 0 & h / v_y \end{bmatrix} \begin{bmatrix} x - x_0 \\ y - y_0 \end{bmatrix}

When using sheared Transform2D matrices in engines like Godot, hit-testing must use affine_inverse() rather than orthonormal inverse helpers, while navigation and collision polygons stay defined in world ground coordinates via explicit module contracts:

{
  "module": "corridor_straight",
  "footprint_units": [4, 2],
  "ground_basis_px": [[64, 24], [-64, 24]],
  "anchor_px": [256, 288],
  "ports": [
    {"edge": "west", "offset_units": 1, "width_units": 1},
    {"edge": "east", "offset_units": 1, "width_units": 1}
  ],
  "layers": ["ground", "facade", "foreground_occluder"]
}