Not logged in, Join Here! or Log In Below:  
News Articles Search    

 Home / 3D Theory & Graphics / Bloom specifics Account Manager
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.
Steven Hansen

April 21, 2005, 02:40 PM

I've been searching all morning (using Google) for additional information on the Bloom effect. Does anyone know a great resource for this effect?

The microsoft directx sdk has a HDR lighting demo that includes bloom, but it is very confusing, and I am not rendering an HDR scene! The example uses fMiddleGray and fWhiteCutoff and Luminance - and *no* documentation worth anything (no idea what those things are for). Additionally, most of their effects are identical in that they take multiple samples, multiply them by some weight, and then add them together. No rhyme or reason is given to the values chosen for weights or offsets. In fact, the code obfuscates which weights and offsets are even being used!

Numerous sites talk about bloom as if it were a simple blur, but obviously that wouldn't overflow only areas of high intensity. The DX docs mentioned something about doing a luminance summation over large areas of the image - even using the gpu to perform the summation, but the documentation is sketchy and I can't follow the obfuscated and undocumented code example. I feel like I'm trying to reverse engineer the code!

Now - I could make guesses about how this effect is done, and make an approximation. eg, I *could* convert to grayscale, and simply subtract a certain value from the intensity, blur the result and combine it with the original. However, I don't really want to alter the color of the areas of high intensity (which adding grayscale would do) ... do I? Additionally, a simple cutoff value for high luminance is going to "bloom" any bright pixels on the screen - regardless of their surroundings. I would think it should only bloom fairly high intensity areas... not solitary pixels - right? Anyway, the point is that I don't know, and could end up wasting a lot of time experimenting with loser solutions. A good resource on the topic would be really nice.



April 21, 2005, 02:48 PM

As far as I know, bloom is just a Gaussian blur applied to all the pixels with an intensity greater than some threshold, and the results of the blur are then blended additively into the original image. Yes, it will bloom single high-intensity pixels - but the effect of this will be less visible when using a larger filter radius.

It is most often used with HDR scenes so that you can scale the intensity of the bloom according to the intensity of the pixels, which gives an additional cue for brightness because the bloom can be bigger and smaller even when the pixels saturate to white. It's difficult to pull this off in LDR, though you can problably make it work with some tricks.

Steven Hansen

April 21, 2005, 05:55 PM

Bloom does involve Gaussian blur after taking intensity into account, but the DX docs (example) claim more.

They claim that we can somehow obtain a relative luminosity for the scene, and somehow make decisions based on that value. I can't find where this is happening in the source code. The formulas listed at that site don't have any theoretical background... which I would like to see.

Particular of interest to me is the Bright-Pass filter. Why do they do this:

  2. // Determine what the pixel's value will be after tone mapping occurs
  3. vSample.rgb *= g_fMiddleGray/(fAdaptedLum + 0.001f);
  5. // Subtract out dark pixels
  6. vSample.rgb -= BRIGHT_PASS_THRESHOLD;
  8. // Clamp to 0
  9. vSample = max(vSample, 0.0f);
  11. // Map the resulting value into the 0 to 1 range. Higher values for
  12. // BRIGHT_PASS_OFFSET will isolate lights from illuminated scene
  13. // objects.
  14. vSample.rgb /= (BRIGHT_PASS_OFFSET+vSample);

Where did they come up with the values they use? Why are they using this math? What's up with the division there at the end?

I could probably figure out what and why... eventually, but a good site on the topic would be a most welcome reprieve.


April 26, 2005, 03:17 PM

You can find an explanation of how the bloom in Tron 2.0 was implemented here:

(Gamasutra requires free registration).


April 26, 2005, 04:49 PM

That article also appears in the original GPU Gems.

Basically, it has certain textures or areas of certain textures marked as glow sources. Which doesn't help in creating glows from arbitrary bright areas of the scene.

I don't know how the DirectX sample "bright-pass" filter works, but it seems to have something to do with the tone mapping and the "exposure" of the scene. Perhaps what they are doing is detecting the areas that will saturate to white under the tone mapping.

This thread contains 5 messages.
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.