# rk_spark
Spark and burning-debris streak. The card's Y axis lies along the particle's motion
(`zero_billboard_streak`) and the graph stretches it by speed, so the fragment draws a thin line
along the card, brightest at the head (+Y) and fading toward the tail, plus a bright spot at the
head. The colour is the lane colour times that shape, the lane opacity and `gain`, returned with
alpha 1 for additive blending.
The `launch` graph (`launch/launch.procGraph`) draws its `sparkStreaks` output with it (additive,
`gain` 1.4): sparks and burning chunks thrown from where the exhaust hits the ground, bouncing off
the scene, stretched from 1.5 to 9 times their size over speeds 0 to 30, and coloured from an HDR
ramp that cools from `(12, 9, 4.5)` to dark red over life. In the Procgen Effects Showcase world, the `fx_launch` scene plays the graph.
The shader includes `@builtin::shaderModules.billboard`.
## Properties
| Property | Type | Default | Meaning |
|---|---|---|---|
| `gain` | float | 1.0 | Multiplies the output colour (minimum 0). |
| `vertexBoundsDilation` | float | 0.3 | How far the vertex hook moves a vertex past the mesh, in world units: the culling bounds grow by it so a moved vertex stays inside them. |
## Lanes
| Lane | Carries |
|---|---|
| `data0.rgb` | HDR colour. |
| `data0.a` | Opacity, multiplied into the colour. |
# rk_smoke
Billowing smoke or steam puff: an alpha-blended, camera-facing card (`zero_billboard`). A soft body
is broken up by two layers of four-octave value noise, so overlapping puffs merge into one rolling
mass. Each card is rotated by its random value and turns slowly over life. The density's gradient
gives a lumpy normal, lit by the sun direction projected into the card's plane and un-rotated so the
light stays fixed on screen. The lighting uses fixed values: a cool sky fill `(0.20, 0.22, 0.28)`
plus the sun's normalised colour, scaled by `sun_gain` and `brightness`, with thick middles shadowed
by their own mass. A warm exhaust underglow `(3.0, 1.05, 0.28)`, scaled by the lane's heat and
`glow_gain`, is strongest on the underside and where the puff is thin. The alpha is the density
times the lane opacity and `opacity`, faded against the scene behind it over `depth_fade` and faded
in over `ground_fade` above world height 0.
The `launch` graph (`launch/launch.procGraph`) draws two outputs with it, transparent: `smokeCards`,
the smoke born where the exhaust hits the ground, pushed out of the trench mouths and trailing the
climbing vehicle (`sun_gain` 0.8, `depth_fade` 2.5, `ground_fade` 0.6, heat 1.0 at birth falling to
0 by half its life), and `steamCards`, the white deluge steam during the countdown (`sun_gain` 0.8,
`glow_gain` 0.8, `depth_fade` 2.0, `ground_fade` 0.5, heat 0.7 falling to 0 by 0.4 of its life). In the Procgen Effects Showcase world, the
`fx_launch` scene plays the graph.
The shader includes `@builtin::shaderModules.billboard` and `zero::scene_depth`.
## Properties
| Property | Type | Default | Meaning |
|---|---|---|---|
| `opacity` | float | 1.0 | Multiplies the alpha (minimum 0). |
| `sun_gain` | float | 1.0 | Multiplies the sun term (minimum 0). |
| `glow_gain` | float | 1.0 | Multiplies the exhaust underglow (minimum 0). |
| `depth_fade` | float | 1.5 | Distance over which the puff fades into the scene behind it (minimum 0). |
| `ground_fade` | float | 0.35 | World height over which the puff fades in above height 0 (minimum 0.01). |
| `brightness` | float | 1.0 | Multiplies the lit colour (minimum 0). |
| `vertexBoundsDilation` | float | 15 | How far the vertex hook moves a vertex past the mesh, in world units: the culling bounds grow by it so a moved vertex stays inside them. |
## Lanes
| Lane | Carries |
|---|---|
| `data0.rgb` | Tint. |
| `data0.a` | Opacity; also scales the underglow. |
| `data1.x` | Life, 0 to 1: the card's slow turn. |
| `data1.y` | Random 0 to 1: rotation and noise offset. |
| `data1.z` | Heat 0 to 1: how much exhaust light the puff catches. |
# rk_flame
Rocket exhaust flame: an additive, camera-facing card (`zero_billboard`) whose shape is eaten away
by animated fBm, so a stack of them reads as one turbulent, white-hot plume. Each card is a disc
rotated by its own random angle, and a four-octave value noise scrolls through it with time at a
per-card speed so the surface churns. The young flame is nearly a solid disc; as life rises the
noise erodes it more (erosion from 0.25 to 0.95), until the old flame shreds. A hot inner bloom
fades out over the card's life. The colour is the lane colour times the shape and bloom, its opacity
and `gain`, returned with alpha 1 for additive blending.
The `launch` graph (`launch/launch.procGraph`) draws two outputs with it, additive: `flameCards`
(`gain` 1.0), the exhaust from the six nozzles, each a tight blinding core wrapped in a wider
turbulent sheath, plus the ignition flash in the trench, and `splashCards` (`gain` 0.85), the fire
splashing sideways where the plume hits the ground. Both colour the cards from an HDR ramp that runs
from white-hot `(20, 18, 14)` to a dark red that fades to nothing, and grow the cards over life. In the Procgen Effects Showcase world, the
`fx_launch` scene plays the graph.
The shader includes `@builtin::shaderModules.billboard`.
## Properties
| Property | Type | Default | Meaning |
|---|---|---|---|
| `gain` | float | 1.0 | Multiplies the output colour (minimum 0). |
| `vertexBoundsDilation` | float | 14 | How far the vertex hook moves a vertex past the mesh, in world units: the culling bounds grow by it so a moved vertex stays inside them. |
## Lanes
| Lane | Carries |
|---|---|
| `data0.rgb` | HDR colour, already walked along the particle's life by the graph. |
| `data0.a` | Opacity, multiplied into the colour. |
| `data1.x` | Life, 0 to 1: sets the erosion and fades the inner bloom. |
| `data1.y` | Per-particle random 0 to 1: the card's rotation, noise offset and churn speed. |
| `data1.z` | Named a stretch or turbulence hint in the shader header; the `launch` graph writes 0 here for its flame cards. |
# rk_haze_mat
Heat-shimmer material for the rocket launch. The `launch` graph beside it (`launch.procGraph`)
resolves it by name and draws its `hazeCards` output with it: one card per particle of a
500-particle simulation fed from where the flame hits (36 per second at full thrust, living 1.2 to
2.4 s) and from the plume column (14 per second at full thrust, living 0.9 to 1.8 s). Each card
grows from 0.7 to 1.4 times its size over its life, and its lane-0 colour comes from a ramp whose
alpha rises to 0.9, falls to 0.5 and ends at 0; the shader reads that alpha as its strength. The
graph's comment states that a `.material` asset is used here because the draw order matters for the
haze. The `launch_fx` Generator entity runs the graph.
The description in mat.yaml states that it is drawn before every other transparent surface, so it
bends only the opaque scene and the flame and smoke drawn over it stay intact.
Shader: `rk_haze` (`rk_haze.shader`). Its header: a large, transparent, camera-facing card that
draws nothing of its own; it re-reads the scene colour behind it through a small, drifting noise
offset, so the air above the flame trench and around the plume wobbles. The card's alpha follows how
much the bent read differs from the straight one, so it is visible at edges in the opaque scene and
blends away over flat sky or ground.
Render state (the `render` block of mat.yaml): `queue: 2600`, `type: transparent` (alpha blend),
`cull: none`, `depth_write: false`.
## Properties
- `strength: 16.0`: scale of the noise offset, in pixels, applied to the scene-colour read (default
38.0).
- `edge_gain` keeps its default, 6.0: multiplier that turns the colour difference into alpha.
# effectShowcase
The procedural effects of the Procgen Effects Showcase world. Each one is a `.procGraph` that plays
through a `Generator`, and every shader, material and module a graph draws with sits beside it in
this package, so the package carries everything its graphs need. Each graph's README says what it
makes, how to place it and what each of its inputs changes.
## Contents
| Folder | Graphs | What they make |
|---|---|---|
| `combat/` | `impact`, `muzzleFlash`, `tracer` | A round striking a hard surface, the bloom at a barrel as a weapon fires, and the glowing streak of a round in flight. They draw with `fxFlash`, `fxSmoke` and `fxSpark` in `combat/shaders/`. |
| `blast/` | `wall_blast` | A charge blowing a breach through a stone block wall, on a 9.6 s loop. |
| `storm/` | `storm`, `tower` | A thunderstorm around a lone tower: wind-driven rain, lightning striking on the schedule `schedule.module` keeps, and sparks and smoke where strikes land. `tower` is the stone keep it stands around. |
| `rift/` | `arcane_rift` | A rift tearing open in the ground, its motes and rubble moved by the compute shaders in `rift/compute/`. |
| `dragon/` | `dragon_breath` | A dragon's fire breath sweeping a courtyard: a flame jet, rolling smoke and drifting embers. |
| `launch/` | `launch` | A heavy-lift rocket liftoff on one looping timeline, with the heat-haze material `rk_haze_mat`. |
| `waterfall/` | `wf_env`, `wf_water`, `wf_spray`, `wf_foam`, `wf_mist` | A waterfall built in parts: the cliff, basin and boulders, the falling and still water, the droplets, the foam where the falls land, and the mist with its rainbow. Its water materials are in `waterfall/materials/`. |
| `shaders/` | | `fx_noise`, the noise functions the waterfall and wall blast shaders include. |
## Playing one
A graph plays on a `Generator` component bound to it:
```lua
-- `graph` is the graph's reference: the AssetRef `asset.resolve` or a search returns for it.
local e = entity.spawn("impact", { position = { 0, 1, 0 } })
e.component.add("Generator", { graph = graph, playOn = "load" })
```
Set a graph's inputs with the Generator's `params`, e.g. `params = { size = 3 }`.