Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Bloom, glow, blur?

This thread is locked; no one can reply to it. rss feed Print
Bloom, glow, blur?
Manunderground
Member #11,529
December 2009

You guys helped me greatly a few weeks ago with your input, and im really hoping you guys can help me out again. My game has come a long way, and now im trying it put some polish on it, primarily im trying to make a bloom, or glow effect on my ship. i have done some Google searching but can only find ways to do this in things like openLayer, or openGL, i know Allegro uses OpenGL but is there a know way to do this strictly in Allegro, with blitting and blending? if so any advice would be greatly appreciated! thank you guys in advanced!

type568
Member #8,381
March 2007
avatar

If I understand your effect correctly, I think it can be done manually with putpixel & getpixel(make sure you've acquired the bitmaps, and following them the way they're allocated in memory), by making some of the color coefficient to be based on surrounding pixels.

Append: If there won't be much of this effect, it won't be much of a penalty on for your frame rates..

Mark Oates
Member #1,146
March 2001
avatar

If you're not going to be using any type of hardware acceleration, try FBlend. It'll at least give you additive blending (for glow effects).

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

CursedTyrant
Member #7,080
April 2006
avatar

For bloom and blur you'd be better off using either HLSL (that's using DirectX, so it's probably not what you want) or GLSL, which are basically shader languages (so, hardware only). I guess you can emulate bloom in software using getpixel/putpixel, but you'd need to come up with a clever way of doing things.

Basically, bloom just brightens the pixels that are already bright (above a certain treshold) and just leaves every pixel below the threshold be. So yeah, you can do that, but it might be slow, as you're probably going fullscreen with this, and as such, you'll need to operate on the entire screen area in the buffer, and then blit the buffer to the screen. Not really hard to do, but it might (I really have no idea) be slow.

And I second FBlend. It's a great library, and it comes in handy if you're using the old Allegro branch.

---------
Signature.
----
[My Website] | [My YouTube Channel]

gnolam
Member #2,030
March 2002
avatar

Basically, bloom just brightens the pixels that are already bright (above a certain treshold) and just leaves every pixel below the threshold be.

Rather, bloom is just running a low pass filter (blur) of all the pixels over a certain brightness threshold. And doing low pass filtering in software? Slow. Horrendously slow.
So yes, it's doable, but it's going to be too slow to be usable (you need a pretty large radius to make it look good).

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

Billybob
Member #3,136
January 2003

gnolam said:

So yes, it's doable, but it's going to be too slow to be usable (you need a pretty large radius to make it look good).

A box filter is dirt cheap, and costs the same no matter what size.

Fladimir da Gorf
Member #1,565
October 2001
avatar

For anyone who is interested making simple convolution filters, there's:

http://developer.nvidia.com/object/convolution_filters.html

OpenLayer has reached a random SVN version number ;) | Online manual | Installation video!| MSVC projects now possible with cmake | Now alvailable as a Dev-C++ Devpack! (Thanks to Kotori)

Go to: