bloom effect (openFrameworks wrapper/example)

Searching through the forums, I see that there’s been some discussion on creating a “bloom” or “glow” effect in openFrameworks. A few people even seem to mention having working examples.

Would anyone be willing to post some sample openFrameworks code? Or some instructions on how to get started?

I found the link to Philip Rideout’s OpenGL Bloom Tutorial (, but I’m afraid it’s a bit over my head. I’m having trouble connecting the dots to figure out how I can port his C code to openFrameworks in Code::Blocks and achieve similar effects on, say, images.

I’ve gathered that it involves using pixel shaders / textures and creating an FBO, but I’m not sure how to put all of those pieces together.

Thanks very much in advance.

The usual steps for a bloom effect are something along these lines:

  1. Render your scene into an offscreen texture (fbo)
  2. Bind your fbo texture and render into another texture while running a luminance threshold shader. You want to discard dark pixels and only let the bright areas pass through to the next step.
  3. Apply a gaussian blur to the texture from step #2
  4. Render main texture (step#1) to screen
  5. Render blurred texture with additive alpha blending

The gaussian blur is the costly step here, what most people do is use a texture half the size
of the output for the blur-step and when rendering to final output you stretch it and get some
extra free blurring from the hardware, also going down to half-size will save you boatloads
performance-wise. The quality of the blur will decide the quality of the overall effect so you
will have to play around and tweak your kernel. I’ve seen people do the blur in a single step
but I prefer to do it in two steps, first apply a horizontal blur to the texture from step #2 and
then use that new one to apply a vertical blur. Also you can combine step 4&5 into it’s own
shader if you wan’t to have more control over how the blending is applied.

There are ofx addons out there for both FBO’s and GLSL shaders so you don’t need to roll
your own unless you feel like doing so as a learning exercise.

Hope this helps.

  • Edvin