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

## 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 on other sites
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 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 Blurfor(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 Blurfor(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.

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

##### 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 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.

1. 1
Rutin
28
2. 2
3. 3
4. 4
5. 5

• 11
• 13
• 11
• 10
• 13
• ### Forum Statistics

• Total Topics
632952
• Total Posts
3009438
• ### Who's Online (See full list)

There are no registered users currently online

×