Table of Contents

Class TerrainLayerTable

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A scene's per-layer numbers as one small float texture the array terrain shader loads by layer: column = layer, row = which number. Replaces the per-layer uniform arrays (_FishLayerST[32] and the rest).

public static class TerrainLayerTable
Inheritance
TerrainLayerTable
Inherited Members

Remarks

Why a texture. At 256 layers the six arrays and the three path tables would be 27 KB of constants, pushed per terrain tile through its property block — more than the 16 KB uniform block OpenGL ES and WebGL guarantee, and exactly the pattern that broke the grass on OpenGL (large constant arrays varied per draw: unity-gl-indirect-args-barrier-bug). A structured buffer is not readable in a WebGL 2 fragment shader. A texture is one binding everywhere, read with Load (no sampler, exact floats).

Rows, Width columns each (Pack(int, Vector4[], Vector4[], Vector4[], Vector4[], Vector4[]) for the first five):

  • RowST: 1 / tile size and offset / tile size, applied to world x/z.
  • RowTint: the diffuse remap maximum (a tint), normal scale in w.
  • RowMaskOffset, RowMaskScale: the mask remap as sample × scale + offset.
  • RowSurface: metallic, smoothness multiplier, has-mask flag.
  • RowFlora: what the layer is made of for the planet's looks (LayerFlora()).
  • RowPaths: the slices of the layer's own biome's path ground, road ground and cobbles (−1 none).
  • RowBackdrop: not a layer's but a backdrop channel's: the scene layer channel c of the backdrop's control maps holds (ControlLayers), c itself when the backdrop names none.
  • RowGlow: the layer's glow (2026-10-25, phase I2r; Biomes.BiomeGroundGlow.Pack), zero for none.
  • RowClock: how the layer follows the shared clock (2026-10-26, phase GROUND-BANDS; Biomes.BiomeGroundClock.Pack): x kind, y from, z to, w falloff; zero for none.
  • RowClockShare: x the share a clocked layer keeps outside its window, y the layer that takes the rest (−1 none), w 1 in every column when any layer of the scene follows a clock (the shader's one test before it reads more).

Columns past the scene's layers hold a neutral layer, no flora and no paths, as the arrays' unused slots did.

Fields

RowBackdrop

public const int RowBackdrop = 7

Field Value

int

RowClock

public const int RowClock = 9

Field Value

int

RowClockShare

public const int RowClockShare = 10

Field Value

int

RowFlora

public const int RowFlora = 5

Field Value

int

RowGlow

public const int RowGlow = 8

Field Value

int

RowMaskOffset

public const int RowMaskOffset = 2

Field Value

int

RowMaskScale

public const int RowMaskScale = 3

Field Value

int

RowPaths

public const int RowPaths = 6

Field Value

int

RowST

public const int RowST = 0

Field Value

int

RowSurface

public const int RowSurface = 4

Field Value

int

RowTint

public const int RowTint = 1

Field Value

int

Rows

Rows.

public const int Rows = 11

Field Value

int

Width

Columns: one per layer an index map can name.

public const int Width = 256

Field Value

int

Methods

Create(string)

A table texture, empty: RGBA float, point, clamped, no mips, never saved.

public static Texture2D Create(string name)

Parameters

name string

Returns

Texture2D

Fill(Texture2D, Vector4[])

Writes packed texels (Pack(int, Vector4[], Vector4[], Vector4[], Vector4[], Vector4[], Vector4[], float[], float[], float[])) into a table and uploads it.

public static void Fill(Texture2D table, Vector4[] texels)

Parameters

table Texture2D
texels Vector4[]

Pack(TerrainArraySet, float[], float[], float[], int[])

The table of a baked set (its numbers and flora), a scene's path maps and its backdrop's channels.

public static Vector4[] Pack(TerrainArraySet set, float[] earth, float[] road, float[] stone, int[] backdropChannels = null)

Parameters

set TerrainArraySet
earth float[]
road float[]
stone float[]
backdropChannels int[]

Returns

Vector4[]

Pack(int, Vector4[], Vector4[], Vector4[], Vector4[], Vector4[], Vector4[], float[], float[], float[], int[], Vector4[], Vector4[], Vector4[])

The table's texels, row after row (texel (layer, row) at row × Width + layer).

public static Vector4[] Pack(int layerCount, Vector4[] st, Vector4[] tint, Vector4[] maskOffset, Vector4[] maskScale, Vector4[] surface, Vector4[] flora, float[] earth, float[] road, float[] stone, int[] backdropChannels = null, Vector4[] glow = null, Vector4[] clock = null, Vector4[] clockShare = null)

Parameters

layerCount int

The scene's layers; columns past it are neutral.

st Vector4[]
tint Vector4[]
maskOffset Vector4[]
maskScale Vector4[]
surface Vector4[]
flora Vector4[]

Per layer what it is made of; null leaves the row zero (the looks then leave the ground as it is).

earth float[]

Per layer its biome's path ground slice (−1 none); null or short: −1 past it.

road float[]
stone float[]
backdropChannels int[]

The scene layer of each backdrop channel; null or short: the channel's own number.

glow Vector4[]

Per layer its packed glow (LayerGlow); null or short: none past it.

clock Vector4[]

Per layer its packed clock (LayerClock); null or short: none past it.

clockShare Vector4[]

Per layer its clock's floor and yield layer (LayerClockShare); null or short: none.

Returns

Vector4[]