{
 "id": "fp16-stochastic-rounding-reaction-field",
 "title": "Coupled Ground Reaction-Front Field with FP16 Stochastic Rounding",
 "aliases": [
  "FP16 stochastic rounding decay",
  "coupled elemental ground field",
  "stochastically rounded half-float surface PDE"
 ],
 "domain": "simulation",
 "subdomain": "coupled surface fields",
 "stage": "simulation",
 "realtime": "realtime",
 "platforms": [
  "webgl2",
  "webgpu",
  "desktop-gpu",
  "mobile-gpu",
  "cuda"
 ],
 "year_introduced": 2021,
 "inputs": [
  "texture",
  "particles"
 ],
 "outputs": [
  "texture",
  "material-params"
 ],
 "style": "both",
 "dynamic": "dynamic",
 "summary": "Evolve multi-channel persistent surface reaction fronts (heat, char, wetness, frost, cracks) in bandwidth-efficient RGBA16F ping-pong targets, using per-texel stochastic rounding so slow high-frame-rate exponential decays never stall on 10-bit mantissa quantization.",
 "how_it_works": "Real-time arenas often track coupled persistent ground effects—heat melting frost into wetness, wetness quenching fire, frost creeping along crystalline veins, or cracks radiating outward—in world-aligned ping-pong MRT textures. Storing eight channels in `RGBA16F` halves memory bandwidth relative to `RGBA32F`, but IEEE half-precision floats have only 10 mantissa bits (a minimum relative step of $\\approx 2^{-10} \\approx 0.1\\%$). At 120–144 Hz, a slow decay with time constant $\\tau = 25\\,\\text{s}$ changes a texel by roughly $0.03\\%$ per frame, which round-to-nearest hardware silently snaps back to the old value—causing permanent stagnation.\n\n**Stochastic rounding** (Connolly, Higham & Mary 2021) eliminates this stagnation in expectation without switching to FP32. When writing a decayed value $x$ between adjacent FP16 representable levels $x_-$ and $x_+$, the shader adds a uniform hash-based dither offset proportional to the local FP16 ULP before quantizing, rounding up with probability $(x - x_-)/(x_+ - x_-)$ and down otherwise. Averaged over frames and neighboring texels, the decay remains unbiased and smooth across any refresh rate.\n\nTo stay within tight frame budgets at high resolutions, active impact regions are clustered into a few bounding boxes stepped every frame while inactive areas update via rotating row bands using accumulated `dt`, with directional masks gating propagating fronts.",
 "when_to_use": "Choose it when maintaining large, multi-channel interactive ground or surface state textures (scorch, snow, frost, wetness, corrosion) in FP16 on bandwidth-bound desktop or mobile GPUs at high refresh rates.\n\nPrefer [deferred-and-projected-decals](deferred-and-projected-decals) when effects are isolated stamps that do not chemically react, diffuse, or propagate into neighboring texels. Prefer [gray-scott-reaction-diffusion](gray-scott-reaction-diffusion) when simulating organic Turing pattern synthesis rather than gameplay-coupled state channels. Prefer FP32 storage when exact deterministic per-texel precision is required and bandwidth headroom allows.",
 "cost": {
  "class": "cheap",
  "notes": "Halves render-target memory and bandwidth versus FP32; combining active bounding-box updates with rotating background row bands keeps a 1024×1024 dual-MRT field well under a fraction of a millisecond on desktop GPUs."
 },
 "failure_modes": [
  "High-frequency spatial hash noise from stochastic rounding can become faintly visible if the field is rendered directly without material filtering or mask modulation",
  "Rotating-band partial updates cause non-active areas to decay in subtle staggered sweeps if band count is too high or accumulated dt is large",
  "Fixed world-aligned textures waste resolution on distant terrain unless clipped to a bounded arena or scrolled as a toroidal clipmap",
  "Over-tight baked mask thresholds can trap propagating frost or crack fronts in fragmented isolated islands"
 ],
 "sources": [
  {
   "role": "primary",
   "key": "doi:10.1137/20m1334796",
   "type": "paper",
   "title": "Stochastic Rounding and Its Probabilistic Backward Error Analysis",
   "authors": [
    "Michael P. Connolly",
    "Nicholas J. Higham",
    "Theo Mary"
   ],
   "year": 2021,
   "venue": "SIAM Journal on Scientific Computing",
   "url": "https://doi.org/10.1137/20m1334796",
   "ids": {
    "doi": "10.1137/20m1334796"
   },
   "license": null,
   "extra": {
    "csl_type": "journal-article"
   },
   "provenance": {
    "title": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1137/20m1334796",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1137/20m1334796",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1137/20m1334796",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1137/20m1334796",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "crossref",
     "endpoint": "https://api.crossref.org/works/10.1137/20m1334796",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": 1,
   "__bib": "connolly2021stochastic"
  },
  {
   "role": "implementation",
   "key": "gh:humpalumps/ultra-elements",
   "type": "code",
   "title": "Humpalumps/ultra-elements",
   "description": "Real-time elemental spell VFX lab for three.js (WebGL2): 39 tunable spells",
   "authors": [
    "Humpalumps"
   ],
   "year": 2026,
   "venue": "GitHub",
   "url": "https://github.com/Humpalumps/ultra-elements",
   "ids": {
    "repo": "Humpalumps/ultra-elements"
   },
   "license": "MIT",
   "extra": {
    "stars": 131,
    "stars_checked": "2026-11-30",
    "archived": false,
    "fork": false,
    "pushed_at": "2026-10-30T21:54:34Z",
    "language": "JavaScript",
    "homepage": null,
    "license_name": "MIT License"
   },
   "provenance": {
    "title": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "authors": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "year": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "venue": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "url": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    },
    "license": {
     "authority": "github",
     "endpoint": "https://api.github.com/repos/Humpalumps/ultra-elements",
     "checked_at": "2026-11-30T17:59:51.239Z"
    }
   },
   "status": "verified",
   "checked_at": "2026-11-30T17:59:51.239Z",
   "title_sim": null,
   "__bib": "humpalumps2026humpalumps"
  }
 ],
 "presets": [
  {
   "id": "fp16-ground-field-default",
   "title": "Dual-MRT FP16 reaction-field partial-update defaults",
   "runtime": "json-params",
   "params": {
    "texture_format": "RGBA16F",
    "mrt_targets": 2,
    "max_active_boxes": 4,
    "rotating_background_bands": 32,
    "slow_decay_tau_seconds": 25
   },
   "basis": "original",
   "license_note": "written for this index",
   "execution_fidelity": "parameter-only",
   "proof": {
    "kind": "parameter",
    "label": "parameter preset",
    "ok": true,
    "proof": null
   }
  }
 ],
 "related": [
  "gray-scott-reaction-diffusion",
  "reaction-diffusion-textures",
  "deferred-and-projected-decals",
  "weathering-simulation",
  "gpu-particle-systems"
 ],
 "extends": [],
 "supersedes": [],
 "combines_with": [
  {
   "id": "gpu-particle-systems",
   "why": "Floor-contacting particles render additively into a cleared paint target that injects heat, wetness, frost, or acid straight into the reaction field."
  },
  {
   "id": "deferred-and-projected-decals",
   "why": "Floor materials sample the persistent multi-channel reaction texture alongside static decals to blend roughness, emissive glow, and fracture reliefs."
  }
 ],
 "provenance": {
  "prose": "original text written for this index (research draft, editorially reviewed)",
  "sources_verified_at": "2026-11-30T17:59:51.239Z",
  "draft": "data/drafts/simulation/fp16-stochastic-rounding-reaction-field.json"
 },
 "solves": [
  "reaction-diffusion or wetness pde freezes solid when stored in fp16 textures",
  "small per-frame simulation increments underflow to zero in half float buffers",
  "cut fluid or chemical field memory bandwidth in half without stalling evolution",
  "eliminate visible quantization banding in slow-evolving fp16 gpu simulations",
  "preserve long-term diffusion conservation using randomized rounding on half floats"
 ],
 "authority": "Connolly et al., 2021",
 "url": "https://texelatlas.vercel.app/t/fp16-stochastic-rounding-reaction-field/",
 "execution_fidelity": "parameter-only",
 "fidelity_label": "Parameter Preset",
 "benchmark_eligible": false
}