How to do a Quick, Dirty bloom effect FAST!
I am trying to add a bloom effect by copying the back buffer to a texture, apply a scale and bias to make it grayscale, and downsample it to make it pixelated. However there are no examples of this on the 'net, any better ways (not using fbos or pbos or pbuffers), or examples of how to do this?
You could render the scene (with exaggerated lighting if necessary) to a small viewport (say 64x64), copy that to a texture, then draw scaled using linear filtering over the top of your full sized scene using additive blending.
The minus is the need to render your scene twice, but pluses are that a small texture is faster to copy and you don't have to do anything 'clever' in terms of downsampling or blurring.
The minus is the need to render your scene twice, but pluses are that a small texture is faster to copy and you don't have to do anything 'clever' in terms of downsampling or blurring.
Any way I can do that on another thread?
Any examples of this?
I am trying to minimize cpu calculations and transfers.
Any examples of this?
I am trying to minimize cpu calculations and transfers.
Maybe try a variation of http://nehe.gamedev.net/data/lessons/les...?lesson=36
But if you want to minimize cpu calcs & transfers, then FBOs and shaders are the way to go imho.
But if you want to minimize cpu calcs & transfers, then FBOs and shaders are the way to go imho.
None of those will work, Im trying to go without extensions for now.
I get a white screen with glCopyTexSubImage2d, I am allocating memory but it refuses to work. I also looked at the Ocean demo, but that does hideous glReadBuffer ops.
My code later ( as I've been doing this whole thread on my iTouch)
I get a white screen with glCopyTexSubImage2d, I am allocating memory but it refuses to work. I also looked at the Ocean demo, but that does hideous glReadBuffer ops.
My code later ( as I've been doing this whole thread on my iTouch)
In regards to the original post... no idea. But in response to the reply... You could just render it once, scale it down into a new texture, and scale that back up. I'd imagine it'd be a lot faster than rendering twice. The results would look different, but probably not significantly?
Yes but glCopyTexSubImage isn't being friendly, but I cant show the code until Saturday or later.
I managed to get it working with an example at zavie.free.fr
However now i get a problem where my pixels of the covering image aren't lining up to my screen:
I figure this is because my rectangle is larger than my viewport of 800 x 500
Edit: No I still get the problem with a viewport of 512 x 512 and 128 x 128
However now i get a problem where my pixels of the covering image aren't lining up to my screen:
Code:
#define Effects_bloomTextureBufferSize 128
.....
glLoadIdentity();
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glOrtho(oe.screen.width,0,oe.screen.height,0,0,1);
glMatrixMode(GL_MODELVIEW);
glColor4f(1,1,1,0.5);
glBindTexture(GL_TEXTURE_2D,bloomTexture);
static float center[2]={oe.screen.width/2,oe.screen.height/2};
glTranslatef(center[0],center[1],0);
glScalef(1,-1,1);
glBegin(GL_QUADS);
glTexCoord2f(1,1);
glVertex2f(-center[0],center[1]);
glTexCoord2f(1,0);
glVertex2f(-center[0],-center[1]);
glTexCoord2f(0,0);
glVertex2f(center[0],-center[1]);
glTexCoord2f(0,1);
glVertex2f(center[0],center[1]);
glEnd();
glColor4f(1,1,1,1);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);Edit: No I still get the problem with a viewport of 512 x 512 and 128 x 128
There was a tutorial once that explained how to do this. If you would like to search for it, the article was called "Real-Time "TRON 2.0" Glow For Low-Spec Hardware". It's pretty fast, works without any extensions and you can leave out different parts such as the multiplication of the source image or the blur to make it faster.
BTW, why don't you want to use any FBOs?
BTW, why don't you want to use any FBOs?
_ibd_ Wrote:There was a tutorial once that explained how to do this. If you would like to search for it, the article was called "Real-Time "TRON 2.0" Glow For Low-Spec Hardware". It's pretty fast, works without any extensions and you can leave out different parts such as the multiplication of the source image or the blur to make it faster.I searched for it but found only dead links.
Quote:BTW, why don't you want to use any FBOs?No matter what the reason is, glCopyTexSubImage is an alternative. It is not as fast as using FBOs, but it is the best choice I know if you must work without FBOs. But you will also need to do (fake) some degree of filtering. Just using a low-res texture can't be enough.
I did a halfway faked glow. I tried doing it the "real" way until I found that the GMA GPU can't do FP buffers. Then I rendered the scene with an offset to put the low ranges under 0, and filtered that with shaders. Worked OK, but doesn't quite fit the demands above.
Just stretching a copy over the previous frame will not work: everything will be pushed outwards toward the edges. Try it in Photoshop or GIMP, you'll see why immediately. I feel obligated to question why you're not using EXTs - fixed pipeline is dead and slow. The modern approaches are not expensive, and much easier to use. Let go of the ringside, man!
Fenris Wrote:Just stretching a copy over the previous frame will not work: everything will be pushed outwards toward the edges. Try it in Photoshop or GIMP, you'll see why immediately. I feel obligated to question why you're not using EXTs - fixed pipeline is dead and slow. The modern approaches are not expensive, and much easier to use. Let go of the ringside, man!
I'm targeting the low-end hardware of 10 years ago, don't ask me why. ( Laughing )
_ibd_ Wrote:There was a tutorial once that explained how to do this. If you would like to search for it, the article was called "Real-Time "TRON 2.0" Glow For Low-Spec Hardware". It's pretty fast, works without any extensions and you can leave out different parts such as the multiplication of the source image or the blur to make it faster.
Does no one know of the awesomeness that is the Internet Archive?
In other words, said article may still be read there: VERC · Real-Time "TRON 2.0" Glow For Low-Spec Hardware. (Yay Internet Archive!)
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Using blending for a text fading effect. | cjcaufield | 2 | 3,491 |
Jun 30, 2010 08:21 PM Last Post: cjcaufield |
|
| Halo-Effect in 3D OpenGL ES | Bersaelor | 4 | 4,720 |
Dec 17, 2009 11:54 AM Last Post: Mark Levin |
|
| malloc particle effect (glDrawArray) | Graphic Ace | 1 | 2,681 |
Mar 15, 2009 03:13 PM Last Post: maximile |
|
| Glow/bloom in OpenGL | Jar445 | 8 | 6,939 |
Jan 31, 2009 07:00 PM Last Post: arekkusu |
|
| Turning Page Effect with OpenGl | ReSuMa | 3 | 4,668 |
May 12, 2007 05:57 AM Last Post: ReSuMa |
|

