Field
The four generator fields of forgeron.sh: ember, globe, dissolve, field.
- Drawn with
- GLSL + CPU
- Chain
- field → pixelate → ordered → grid → palette
- Code
- @forgeron/shaders: fieldMeta, fieldGlsl, fieldCpu
/01 → What it is
- A value per cell from fractal noise: heat from the bottom edge (ember), a lit sphere turning (globe), bands eaten from the left (dissolve), a quiet drift (field).
- Then `ordered` thresholds it with the 8×8 Bayer matrix: whole pixels, never a blur.
- The site mounts the same chain compiled at build time (`field.baked.ts`).
- Both sides: GLSL and CPU, with the same result.
- CPU against GLSL: within a stated share: the noise is float.
/02 → In the examples
| Example | Chain |
|---|---|
| Background | field → pixelate → ordered → grid → palette |
| Transition | field → pixelate → ordered → dissolve → palette |
/03 → Versions
- /01 Live
every setting, on "field-globe" - /02 Ember
mode "ember" - /03 Dissolve
mode "dissolve" - /04 Field
mode "field"
/04 → Use it
{
"type": "field",
"mode": "ember"
}import { fieldMeta, fieldGlsl, fieldCpu } from "@forgeron/shaders";
// fieldMeta: description and params schema (validation, the editor)
// fieldGlsl: the GPU side, for bindChain then glPipeline
// fieldCpu: the CPU side, for bindChain then runCpu{
"$schema": "https://shaders.forgeron.sh/schema/preset.v1.json",
"version": 1,
"name": "field-globe",
"source": {
"type": "field",
"mode": "globe"
},
"passes": [
{
"type": "pixelate",
"size": 4
},
{
"type": "ordered",
"matrix": 8,
"centered": false,
"origin": "bottom",
"steps": [
[
0,
1
],
[
0.86,
0.12
]
]
},
{
"type": "grid",
"gap": 0.16,
"min": 4,
"tone": 0
},
{
"type": "palette",
"tones": [
{
"var": "--bg",
"fallback": "#0a0a0a"
},
{
"var": "--ink",
"fallback": "#ededed"
},
{
"var": "--accent",
"fallback": "#ff4f1f"
}
],
"transparent": []
}
]
}import { builtInPresets } from "@forgeron/shaders";
import { mountPreset } from "@forgeron/shaders/dom";
// WebGL2: every step has GLSL. Validated first.
const handle = mountPreset(canvas, builtInPresets()["field-globe"]);
// later: handle?.destroy();import { builtInPresets, chainOf, runCpu, toRgba } from "@forgeron/shaders";
// The CPU side of every step: RGBA bytes for a PNG, or tone paths for an SVG (toSvgPath).
const rgba = toRgba(runCpu(chainOf(builtInPresets()["field-globe"]), 320, 200, { time: 1.7 }));API → Options
| Option | Type | Default | Description |
|---|---|---|---|
mode | "ember" | "globe" | "dissolve" | "field" | "ember" | Which field. |