What does the threshold in unrealbloompass means and how to make a color just pass that threshold a bit? how to calculate the threshold for a color?


what does the threshold mean?

The threshold is the brightness value over which it will start to bloom that color.

The brightness of its color is basically the max of R , G , and B
(its actually a bit more complex than that… IRL but I think this probably assumes max)

Normally colors are in the 0 to 1 range… but you can set a color higher than 1 on the material…

If you then set material.emissiveColor = new THREE.Color(2,1,1) and a threshold of 1… your object should bloom with red.

The way unrealbloom works, is it takes the input image, and where the brightness value of the pixel is > threshold, it copies those pixels to a new rendertarget, then does a 2 pass gaussian blur on that render target… and then blends that renderdtarget back on top of the original image to create the bloomed image.

2 Likes

what manthrax said is a 100%. for some reason it’s not being used in the official examples. controlling bloom simply with treshold + going outside 0-1 RGB on the materials directly is very easy and doesn’t require any additional work and effect passes or scene traversal. threshold pretty much makes bloom selective ootb.


I see the math algorithm here. Can you explain how the threshold is used there and how to calculate the threshold for a color.

the algorithem code is in the threejs shader LuminosityHighPassShader

The code above computes a luminance value from a color as:

luminance = .299 x <red> + .587 x <green> + .114 x <blue>

You could compute the luminance for a color with that expression, and then choose a higher threshold. But as others have said above, I don’t recommend doing bloom this away. Emissives are not limited to 0–1 RGB values. It’s much easier to choose an emissive color that’s substantially brighter than 1, raise the threshold above 1, and then you’re not risking bloom on a non-emissive white or light-grey surface in the scene.

1 Like

I see, so just make the emisive color higher than 1 will make the bloom selective. thanks.

1 Like