Jump to content
  • Advertisement
Sign in to follow this  
spek

OpenGL Blur

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

Hi, What's a fast way to blur? I could do a gausian blur by taking surrounding pixels from an image in a pixel shader but wouldn't that be slow? For example, if I want 9 pixels (that's a small blur) it takes 9 texture read instructions. Someone here also told me about taking a snapshot of the scene on a lower resolution and then stretching it. Sounds simple but that would mean I need to render the scene twice right? I heard DirectX has a stretch function for that, doesn't OpenGL have something like that? Greetings, Rick

Share this post


Link to post
Share on other sites
Advertisement
May I ask what an FBO exactly is? Is it something like a Vertex Buffer Object? VBO's are stored on the video-card so that the GPU can reach it very fast but what about the FBO? Geometry is static data but the screen pixels will change every frame. Or is a FBO something else? What can you do with it?

[edit]
FBO = Frame Buffer Object. I see. Got confused with the VBO. Anyway, my grandpa video card doesn't support FBO :| Any nice workaround? I don't need ultra-realistic HDR, just some blurring that would also work on older cards.

Thanks for helping!
Rick

[Edited by - spek on October 6, 2005 9:58:34 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by spek
I could do a gausian blur by taking surrounding pixels from an image in a pixel shader but wouldn't that be slow? For example, if I want 9 pixels (that's a small blur) it takes 9 texture read instructions.
You can take advantage of bilinear filtering and sample on the edge of two texels to effectively sample two at the same time. This is usually implemented as a separable filter in two passes. The first pass blurs horizontally and the second pass blurs vertically (or vice versa).
Quote:
Original post by spek
Someone here also told me about taking a snapshot of the scene on a lower resolution and then stretching it. Sounds simple but that would mean I need to render the scene twice right? I heard DirectX has a stretch function for that, doesn't OpenGL have something like that?
That is a very simple way to get an okay blur. Render to a lower resolution texture, and then render that texture as a full-screen quad. It only requires rendering the scene once and then rendering a full-screen quad. And doesn't require any fragment shaders or anything fancy. The quality will also not be very fancy though.

It's probably best to combine the two methods. You can get a pretty good blur with rendering to a low-res texture and then sending that through the two blur passes. This lets you be able to get away with a smaller blur filter than you would need for a similar sized blur using just the two blur passes. The quality might suffer slightly, but not too much.

Hope that helps.

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!