Builtin Library
- ..
- README.md2.4 KB
- properties.yaml1.4 KB
- shader.wgsl6.3 KB
README.md
bloom post-process shader
The light a bright surface spills into the pixels around it. A half-resolution
bright pass extracts what stands above threshold, a pyramid of downsample
passes carries it down to 1/64 of the view, and a chain of upsample passes
carries it back up, blending each octave into the one above it. composite
adds the result to the scene. tools.use("pp", "add", "glow", "bloom")
registers it — the shader declares space: light, so the effect takes the
scene layer: the rendered picture before the UI is drawn, over the scene's own
light in a float target, which is where a bloom belongs.
Passes
| Pass | Scale | What it does |
|---|---|---|
bright | 0.5 | Extracts what stands above threshold from a 2x2 block of the scene, soft-kneed by softKnee. |
down1…down5 | 0.25 … 0.015625 | Each halves the previous octave's resolution with a 13-tap filter; down1 also Karis-averages its five taps to keep a single bright texel from dominating. |
up4…up0 | 0.03125 … 0.5 | Each carries the smaller octave up with a 3x3 tent and blends it into the next one by scatter. |
composite | (view size) | Adds the bloomed image to the scene, scaled by intensity. |
Properties
| Property | Default | Range | Meaning |
|---|---|---|---|
threshold | 1.0 | 0–16 | The brightness the bright pass extracts above. |
softKnee | 0.5 | 0–1 | How wide the roll-in is around threshold, so a surface crossing it brightens rather than pops. |
intensity | 0.6 | 0–4 | How much of the bloomed image the composite pass adds back to the scene. |
scatter | 0.7 | 0–1 | How much of each octave an upsample pass blends into the one above it, and so how far the halo carries. |
levels | 6 | 1–8 | How many octaves of the pyramid draw. |
clampMax | 16 | 0–64 | The per-texel cap the bright pass applies before extracting, so one blazing pixel cannot blow out its octave. |
levels and the 8-texel floor an octave's short side must clear are both read
per pass, not baked into the pass list: an octave past either one returns the
larger image it was handed unchanged, so a slider drag on levels changes what
the twelve passes DO and never how many there are.
Eleven scratch targets in the scene format, the largest at half the view — about 11 MB at 1080p.