Depth of Field glsl150 shader (MS support)

I made a glsl150 shader for the DoF filter, with multisampling support. The screen is taken using 4x, and everything looks fine. Just gonna add some more stuff and do some testing, then post it if anyone wants.





http://www.jamtlandoutdoors.se/images/dist/dofMS.png

3 Likes

I don’t know much about the old one. But, what’s the difference with the old one?

This one works when multisampling is enabled as well. Thats the only difference.

I’m trying an approach I read about in this article. It’s in order to get rid of some leaking colors, and get a HQ version available for promo shots etc.



Currently I’m doing fine. I downsample and blur the image with two materials based on the regular gaussian blur materials, only i changed the blur radius and some other stuff.



This is an image from the new version. There’s no multisampling in this one.



http://www.jamtlandoutdoors.se/images/dist/blurred_background.png



This is an image using 4xMSAA, just to show that there’s progress in that department as well. The blur in this image is extreme, and as you can see its a bit skewed. That’s because the vertical blur doesn’t match the horizontal blur. The reason for this is that gaussian blur uses two different passes (to keep the amount of texture fetches down), and I’m trying to tweak them in order to avoid excessive multisampling (it’s an image that will be blurred after all…).



http://www.jamtlandoutdoors.se/images/dist/still_leaking_some.png



Needless to say it’s gonna be slower then the regular one, but I’ll use it as a high quality alternative. Here’s some extreme blur using the old system. No multisampling.



http://www.jamtlandoutdoors.se/images/dist/color_leaking.png

Hmm no I got what I came for with this, not gonna add the advanced stuff yet. Using gaussian blur filter seems to be pretty much as fast, so it can stay as is until later. Only gonna be using this thing to get a slight distance based blur anyways, for outdoors scenes, and be able to use multi sampling if needed. That works well now. :smiley:



EDIT: It’s AtoC integration time.

@androlo said:
This is an image using 4xMSAA, just to show that there's progress in that department as well. The blur in this image is extreme, and as you can see its a bit skewed. That's because the vertical blur doesn't match the horizontal blur. The reason for this is that gaussian blur uses two different passes (to keep the amount of texture fetches down), and I'm trying to tweak them in order to avoid excessive multisampling (it's an image that will be blurred after all..).

http://www.jamtlandoutdoors.se/images/dist/still_leaking_some.png


It looks to me like there is no horizontal blur at all... it's like the buffer was somehow cleared between horizontal and vertical blurring or the vertical was not run on the horizontal results. The nice thing about a gaussian blur is that it can be done in two passes... but the second pass has to be run on the result of the first.

I was trying some multi sampling stuff out. I think the best thing is to use it in both the blur passes tho, and the regular image.





Started working on getting AtoC supported now. This will be useful for other shaders as well, because the same stuff happens with fog and other filters too.



It seems semi-transparent pixels get a degree of gray, depending on the alpha value. Here’s a pic. The grass has way more semi transparency then the trees.



http://www.jamtlandoutdoors.se/images/dist/alpha_leaking.png

Doh… it was just because the alpha of the frame-buffer texture is not 1.0… The gray is the color of the viewport. Changed viewport color to red and the color on the grass edges became red etc.



I think this issue is pretty much resolved. Just gonna do some more tests.