Jump to content
  • Advertisement
Sign in to follow this  
fpsgamer

arb_fragment_program and gaussian blur.

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

Using arb_fragment_program, how can I access pixels adjacent to the current fragment to build up an interpolation kernel? I want to be sure I am accessing a single pixel value at particular offsets from the current pixel that is being rasterized. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by fpsgamer
Using arb_fragment_program, how can I access pixels adjacent to the current fragment to build up an interpolation kernel?
You cannot because the adjacent pixels are not guaranteed to exist and not guaranteed to have been computed.
You must render to a texture and use texture lookups, in other words, perform a post-processing effect.
Quote:
Original post by fpsgamer
I want to be sure I am accessing a single pixel value at particular offsets from the current pixel that is being rasterized.
You can do that by having a uniform containing 1.0/TEXTURE_DIMENSION, which is a texel width/height. I have tried doing this with NEAREST and it worked just ok to index a large LUT dynamically. Last-gen graphics cards allows you to access the texels indexed as integers directly, but I'm not sure it already makes sense to use this functionality.

Share this post


Link to post
Share on other sites
Quote:
Original post by Krohm
You must render to a texture and use texture lookups, in other words, perform a post-processing effect.


Oh sorry. I should have mentioned that I have already rendered to texture the thing that I want to "blur". Then I re-render that texture to a screen alligned quad.

Quote:
Original post by Krohm
You can do that by having a uniform containing 1.0/TEXTURE_DIMENSION, which is a texel width/height. I have tried doing this with NEAREST and it worked just ok to index a large LUT dynamically. Last-gen graphics cards allows you to access the texels indexed as integers directly, but I'm not sure it already makes sense to use this functionality.


Infact this is what I did. I actually first created another pbuffer exactly the same size as the texture and enabled GL_NEAREST filtering to be absolutely sure that I was accessing a single pixel at a time from the texture map when I offset from my current texture coords.

I just wanted to be absolutely sure that this was the "right" method. As I dont want to be working harder than I have to. There donesnt seem to be a particularly "clean" way in arb_fragment_program to fetch more than one texel without several lines of +1 and -1 increments from the current texture coords.

Share this post


Link to post
Share on other sites
Ok, I see.

If you absolutely want more perf, you could try using a lower mip level. Cutting down to 1/2 or 1/4 of texture dimensions usually doesn't introduce sensible variations in the blurriness.

This basically allows to resolve "blocks" of texels as you want and may give a nice performance boost I suggest you try it out! It's just standard with tonemapping methods.

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!