# ash
Ash: ragged grey flakes falling and turning slowly through the air, a few still smouldering orange at the edge.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# autumnLeaves
Autumn leaves: red, orange, gold and brown leaves with a midrib and stem, tumbling and swinging down through the air.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# cherryPetals
Cherry blossom petals: pale pink sakura petals with the notch at the tip, tumbling and fluttering down, lit by the sun and lanterns, glowing through when backlit.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# drizzle
Light drizzle: thin fine streaks of light rain falling fast, leaning with the wind.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# dustMotes
Dust motes: tiny bright specks hanging almost still in the air, lit up where shafts of sunlight or lamplight pass and invisible in shadow.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# embers
Embers: orange sparks that rise from the ground, flicker and swirl and burn out as they climb, glowing so they bloom.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# fireflies
Fireflies: warm yellow-green lights that rise from the grass, wander slowly and blink on and off, glowing so they bloom at night.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# glowSpores
Glowing spores: bioluminescent teal and green motes floating and pulsing softly in dark forests and caves.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# lanternSparks
Lantern sparks: warm golden sparks and glints that rise lazily from lanterns, braziers and fires, slower and softer than embers, drifting, twinkling and fading as they climb.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Put the Drift entity on the lantern, brazier or campfire (or a few metres under a row of lanterns); the sparks are born in the lowest third of the area box and climb about 2 m before they fade. Night style: with `followClock = "auto"` they come out at dusk and go at dawn. Inputs: count, area, center, follow, density, wind, tint, tintAmount, swayScale, sizeScale, brightness, seed.
# mistWisps
Mist wisps: big soft torn puffs of fog drifting low over the ground and water, slowly growing and fading.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# pollen
Pollen and seed fluff: soft yellow and cream specks floating and rising lazily on warm air, catching the sun.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# snow
Snow: soft round white flakes falling slowly, swaying and turning, lit by the sky and warm under lamps.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# sparkles
Magic sparkles: little four-pointed stars that twinkle, drift upward and fade, glowing gold and blue.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# waterSpray
Waterfall spray: a fine mist of droplets thrown up at the base of a waterfall, falling back and drifting, with rainbow sparkle when the sun is behind you.
A style of the ambientDrift effect: plays the shared `parts/field` part with its own look. Inputs: count, area, center, follow, density, wind, windBase, tint, tintAmount, swayScale, sizeScale, seed.
# field (procGraph part)
One field of drifting ambient particles, the part every ambientDrift style is built from. Outputs
`field`, an instanced population of soft cards drawn with `shaders/driftCard`, and `points`, the live
particles of the GPU solver.
Steered by: `count` and the area box (`areaX/Y/Z`, `centerX/Y/Z`, birth band `bandLow` / `bandHigh`),
`seed`; motion on the solver (`velocity`, `jitter`, `terminal` fall or rise speed, `pull`,
`lifeMin` / `lifeMax`, `sizeMin` / `sizeMax`); and the look and GPU drift handed to the shader
(`shape`, `facing`, `additive`, colours, `tintR/G/B` and `tintAmount`, `glow`, `lit`, `opacity`,
`blink`, `flicker`, `rainbow`, `density`, `windX/Y/Z`, `offsetX/Y/Z`, `swayAmp`, `bob`, `swayHz`,
`spin`, `sizeMul`, `grow`, `streak`, `aspect`, `follow`, `wrapY`, `blend`, `queue`).
# driftCard (shader)
The surface shader every ambientDrift particle draws with: one small card per particle that looks
like a firefly glow, a notched cherry petal, an autumn leaf, a snow flake, a torn mist puff, a
drizzle streak, a four-pointed sparkle, a ragged ash flake, a dust or pollen mote, or a spray
droplet (`shape` 0..9).
- Cards face the camera, tumble in 3D (petals, leaves, ash) or stretch along the fall (drizzle).
- Lit sprites take the sun with its shadows, the sky's ambient and every lamp in reach, with light
through the back of thin petals and leaves and forward scattering on dust; glowing sprites add HDR
light the bloom catches; fireflies blink, embers flicker, spray shows a rainbow near 41 degrees
from the point opposite the sun.
- Wind, sway, bob, spin, the wrap-around inside the area box (or around the camera), the fade at the
box faces and the seeded density share all run in the vertex stage on the gameplay clock.
Each particle's seed and life ride in its instance scale (`size * (1, 1 + seed, 1 + life)`). Every
property is a float; a procedural graph hands it scalars. Used by the `airDrift` effect's
`parts/field`.
# shadows
The shadow-sampling interface every surface shader calls instead of writing its
own PCF loop: `compute_directional_shadow_factor` for the sun (its virtual
shadow map's pages),
`compute_spot_shadow_factor`, `compute_point_shadow_factor` and
`compute_area_shadow_factor` for punctual lights. Each answers 1.0 for fully lit
and 0.0 for fully shadowed.
A shader that walks the punctual lights (`zero_point_light(i)`) rather than
naming one light asks
`compute_punctual_shadow_factor(index, world_pos, normal)` instead, which reads
the row's `kind` and answers for whatever shape it casts in, and weighs the
answers with `zshadow_light_reach(index, world_pos, normal, object_channels)` —
how much direct light that row actually puts on a surface on those light
channels, zero exactly where it puts none, the channel mask included.
`zshadow_punctual_probe` and `zshadow_directional_probe` go one level under a
factor, returning the depth the fragment carries in a light's map beside the
depth the map already held there, loaded rather than compared.
A shader that looks up more than one light for the same fragment shares the
filter's per-fragment rotation between the lookups: it holds one
`var kernel = zshadow_kernel();` and passes `&kernel` to the `_with_kernel`
form of each call (`compute_directional_shadow_factor_with_kernel`,
`compute_directional_shadow_and_transmittance_with_kernel`,
`compute_spot_shadow_factor_with_kernel`, `compute_point_shadow_factor_with_kernel`,
`compute_area_shadow_factor_with_kernel`,
`compute_punctual_shadow_factor_with_kernel`). The first lookup that filters
derives the rotation and the rest read it back, so the fragment hashes its
position once however many lights it is shadowed by. The light loop
`zero_pbr_direct` runs does this, and looks a light up only where the light
puts light on the fragment.
Routing through these is what keeps a shader in step with the renderer — the
page levels, map resolution and filter width come from the bound frame data
rather than from constants baked into the shader. The directional call selects
the level the receiver's screen footprint asks for, and inside a hero box
(`renderer.setShadowHero`) a level finer by the box's level bias.
```wgsl
// @domain: surface
#include "@builtin::shaderModules.shadows"
fn fragment(input: FragmentData) -> vec4<f32> {
let n = normalize(input.world_normal);
let lit = compute_directional_shadow_factor(input.world_position, n, uniforms.light_direction);
return vec4<f32>(vec3<f32>(lit), 1.0);
}
```