Jump to content
  • Advertisement
Sign in to follow this  
grunt123

blooming effect without shader

This topic is 4118 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to implement blooming effect without shader. I can grab backbuffer and render only high-color intensity area to offscreen buffer. But, i'm a bit confused about blurring this texture. People usually say that you blur it horizontally and then vertically. Could anyone explain how this is done? (without shader) thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Well, you could simply render the same quad several times with alpha blending, offset each time. Why are you so averse to using shaders, though?

Share this post


Link to post
Share on other sites
Try looking at
Frame Buffer Postprocessing Effects in DOUBLE-S.T.E.A.L for an explanation on hhow to apply bloom.

The way you perform a blur is by applying a convolution. This involves for each pixel\texel apply a kernel which sums neighbouring pixel with a weight. The simplest convolution is a box blur which takes all neighbouring pixel and averages them. Here the kernel might be a 3x3 where each weight 1/9th.
As the kernel uniform(?) and applying a 2d kernel more expensive than applying two 1d kernel, we can optimse by applying two 1d kernels.

First we apply a 3x1 kernel horizontally then we apply 1x3 kernel vertically.


float hKernel[3] = {0.33f, 0.33f,0.33f};
float vKernel[3] = {0.33f, 0.33f,0.33f};

//Horizontal Blur
for(int y = 0; y < height; y++){
for(int x = 1; x < width - 1); x++){
tmp = hKernel[0] * Buf[(y * width) + x - 1];
tmp += hKernel[1] * Buf[(y * width) + x];
tmp += hKernel[2] * Buf[(y * width) + x + 1];
tmpBuf[(y * width) + x) = tmp;
}
}
//Vertical Blur
for(int y = 1; y < height - 1; y++){
for(int x = 0; x < width); x++){
tmp = vKernel[0] * tmpBuf[((y - 1)* width) + x];
tmp += vKernel[1] * tmpBuf[(y * width) + x];
tmp += vKernel[2] * tmpBuf[((y - 1) * width) + x];
tmpBuf[(y * width) + x) = tmp;
}
}





Thats off the top of my head but is roughly right. Actually the above wont work perfectly as there are details missing (like handling edge condition).
But with with a little research you should be able to fill in the blanks.
Also the above show a simple box blur, but are other blur techniques which may be better.

(Edit) Fixed your link. <3 mittens

[Edited by - mittens on July 12, 2007 8:30:27 AM]

Share this post


Link to post
Share on other sites
Another option would be to decrease the size of the overlay texture and take advantage of the limitations of bilinear texture filtering to blur the image (as described over here). Sneftel's right though, shaders can make this easier to tweak, better looking and consistent across graphics cards. So if you don't have any specific reasons not to use shaders, I'd use 'em :)

Share this post


Link to post
Share on other sites
Thanks for the reply. Currently, i'm developing a game on the console which doesn't have shader capability. I'll definitely look at all these possible options.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!