Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit95280a384c

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

PassScaleWhat it does
bright0.5Extracts what stands above threshold from a 2x2 block of the scene, soft-kneed by softKnee.
down1…down50.25 … 0.015625Each 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…up00.03125 … 0.5Each 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

PropertyDefaultRangeMeaning
threshold1.00–16The brightness the bright pass extracts above.
softKnee0.50–1How wide the roll-in is around threshold, so a surface crossing it brightens rather than pops.
intensity0.60–4How much of the bloomed image the composite pass adds back to the scene.
scatter0.70–1How much of each octave an upsample pass blends into the one above it, and so how far the halo carries.
levels61–8How many octaves of the pyramid draw.
clampMax160–64The 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.