GLSL shader example
Threshold Bloom with Blurred Highlights
Extract highlights, blur them, then add them to the original. These RGBA8 teaching targets demonstrate threshold and spread rather than an HDR bloom pipeline.
Live example
Edit the code and the preview updates as you type.
What to observe
Threshold Bloom with Blurred Highlights.
Mechanism
Extract highlights, blur them, then add them to the original. These RGBA8 teaching targets demonstrate threshold and spread rather than an HDR bloom pipeline.
The controlling code
c=texture2D(u_texture,uv).rgb+texture2D(u_blur,uv).rgb*(.5+u_parameter*2.);
The final Fragment code combines u_texture with the u_blur result; u_bright first removes dim colors. Replace .5+u_parameter*2. in Fragment with 0. to hide bloom entirely, then select u_bright below the preview to inspect the retained source highlights.
Experiment
In the u_bright tab, change smoothstep(.4,.7,l) to smoothstep(.7,.9,l). Fewer source colors survive highlight extraction, so the final glow becomes restricted to brighter parts even at the same composite strength.
Debugging and cost
u_blur performs 81 texture reads per pixel, while the final shader reads the source and blur once each. Change the .004 tap spacing in u_blur to .008 to spread the same taps farther apart; this enlarges the halo without increasing sample count.