Gaussian Blur shader tutorial

Hi there, Im new to OF and going through the shader tutorial here:

http://www.openframeworks.cc/tutorials/graphics/shaders.html

Everything was going well, and then I ran into a very strange bug with the final tutorial section, ping-pong gaussian blur shaders, code here:

https://github.com/openframeworks/openFrameworks/tree/master/tutorials/shader/09_gaussianBlurFilter

When I run this project, I can see the image blurring with mouse movement, as it’s supposed to, however there is a layer of crazy pixel noise “on top” of the image. It basically looks like the snow from a television that’s not set to any input, except it’s colourful. Does anyone have any idea why the blur isn’t working properly? I have a MBP 2014 with and Iris gpu if that’s a factor.

Thanks!

Hey Jag,

Do you mind posting a picture and a sample of your code? It could help us better illustrate what your problem is.

Hi Sheva, thanks for replying. The code is straight from the github repo (the second link above), I havent changed anything. And, unfortunately, Im a new user so OF won’t yet let me post images…

I experienced something similar with that shader in particular. It will run perfect in my computer. But then for an installation I ran it in a mini…surprise, the graphics card didn’t like the shader. After doings some research and testing other machines I realized it was the intel graphic card for some reason. I have a G-force in my personal.

This is my thread about it.

Not sure if you are getting a similar glitch to that. I was able to print the graphic card type and what opengl it supports in the verbose. Also tried forcing the other shaders in the if statement without success :(. Hope this gives some inside.

Yep, it looks exactly like that. Good to know it’s a hardware-related anomaly and not something wrong with the code or my installation. I’d like to know what the exact problem is, but if you haven’t been affected by the issue otherwise I guess I’ll probably be safe. Thanks for your help!

Yeah, I’m also not an expert so I really tried as many things as possible. Not sure if other people with more knowledge can chime in the conversation but I tried almost everything. I didn’t get as far as tweaking the shader myself. Hope you can work around this issue.

Best!

Sheva, and anyone else who might come across this issue, I discovered that the frag shaders in the tutorial code use a variable called color, but do not assign it an inital value. So, to fix this I simply changed the first color update line in each file (shaderBlurX.frag and shaderBlurY.frag) from this

color += 1.0 * texture(tex0, texCoordVarying + vec2(blurAmnt * -4.0, 0.0));

to this

color = 1.0 * texture(tex0, texCoordVarying + vec2(blurAmnt * -4.0, 0.0));

and now it’s working!

Thanks

3 Likes