Jump to content
  • Advertisement
Sign in to follow this  
Centurion

OpenGL My first bloom effect(Suggestion requiest)

This topic is 4235 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

First here it looks like: my bloom I expirienced lots of troubles, and trying to resize image to fullscreen makes impressive lags, still works fast in small window. 1. In all normal languages when i set width to 64, i get pixel numbers from 0 to 63, still this is wrong to OpenGL somehow. Width 64 still means 64 pixels on screen, but i got 65 pixels to work for, probably i'm setting them not like "middle of pixel" but like "corner of pixel" ? dunno. 2. Connects to a first problem - i'm making texture of what i have on screen and draws it again x2 smaller. First i thinked i'll lose each second pixel, even with linear filtration, so i thinked i'll need to move it half pixel to get all pixels counted in. But in fact i got i don't need any halfpixel offset, probably because of "corner of pixel" idea. Anyone knows that's better, would appreciate ) 3. In tutorial i used it's said i need to make 4 less quality images x2,x4,x8,x16 smaller, and blur them +-2 pixels offset with gaussian x5 times each. I'm not sure why that, or i do something wrong, it worked much faster and better quality for me when i do +-5 pixels offset x1 with just ordinary blur. Then i just place back all those images together and i get bloom. Still what i got isn't exactly what showed on screenshot in that tutorial, still looks not bad imho. Secret of good picturing is ofcourse in number of less quality images i use, and blur type, help of anyone expirienced in that appreciated) 4. Original 16 bit buffer makes lot's of distortions, i can't even normal blur with it, mostly because red and blue get 5 bits, and green 6 bits, in big +- blurs i get whole screen simplified to 4 simple greenied colors .. I used to solve that accumulation buffer, but there is another problem - when i'm lowering viewport to x2,x4 etc less size, to blur my less-quality-images, i get feeling that accumulation buffer still works with whole buffer, not part of it, so bluring x16 smaller image is same speed like orginal image, still not sure about that. So a problem arises. Is that better to raise my main buffer rbg to something big enough to avoid artefacts and work with textures for a blur effect, or it's better to use accumulation buffer instead?

Share this post


Link to post
Share on other sites
Advertisement
im not to sure what your problem is, not fast enuf i assume.
the fastest method, with acceptable results is

grab the framebuffer texC
setup 2 textures say 1/4 the size of your window texA,texB

-- start --
with a fragment shader that blurs vertically
draw texC as a fulltexturesized quad
this results as texA

with a fragment shader that blurs horizontally
draw texA as a fulltexturesized quad
this results as texB

now u can either goto start + repeat or else use texB + draw a fullscreen quad



Share this post


Link to post
Share on other sites
Problem when i go for speed, quality goes down so fast it's not acceptable to watch )). There must be some "trick" to make it both fast with good quality, still i'm not so smart to figure this out myself

Share this post


Link to post
Share on other sites
No trick. No golden bullet, either. No magic, to add. There is always the trade off between quality and speed. And to be honest: I don't even know what exactly is the question. To me it just looks like you want to brag about what you achieved. No comment necessary on that.

bye, Thomas

Share this post


Link to post
Share on other sites
Most glow-effect tutorials say you just need to copy ur screen to texture and blur it sometimes, but they always quiet that 5x blurs so slow so they can't be used in game. Drawing x2,x4,x8 smaller textures is a trick for me, and yes - it makes both - fast and nice glow effect. But as in topic name "suggestion requiest" i need any tip of how to increase perfomance, keeping good quality, and "hard places" i put in "1.","2." in the top of the topic.


There is also "edged" problem i not mentioned yet, here it is:

First blures layer looks ok:


But on last ones i get it edged:



Here i marked edges i talk about:



When scene changes dinamycally those edges seen clear enough, and looks like ugly artefact.

Still in original tutorial where i get this techicue from, last layer still looks fine without any edges:

.


Next problem is i need to use accumulation buffer to blur and add layers of glow together, because original buffer bit depth isn't enough and i get green-colored artefacts. And maybe i just don't know some command, but accumulation buffer even when my viewport is small, copies whole buffer, not a part of it, so if i blur 4x4 image with accumulation buffer i get it slow like i blur whole screen.....



[Edited by - Centurion on February 20, 2007 2:10:40 AM]

Share this post


Link to post
Share on other sites
Well, if you're infact using glCopyTexImage2D etc. then it's much slower than it needs to be.
Id recommend either pixelbuffers or FBOs, this way you dont copy anything, but you rather render directly into a buffer.

Here's what I used to learn how to do pbuffers.
You should also find somewhere where they go into usage of pbuffers in detail, if you cant find any I have some links.

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


Oh and BTW, the tutorial you mention is one of the same Ive been reading.
And what he infact tells you to do is this:

-Use a blurfilter of 5x5 kernel size
-Instead of using bigger and bigger kernel sizes, you should use smaller and smaller textures, e.g: 256x256, 128x128, 64x64, 32x32 etc.
This way, you will get an approximated larger kernel while actually increasing speed at each step.
-Then you add all the blurred brightpass-textures into one texture, and additively render it with your unbloomed scene.

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!