Basic Background DoF effect


Hello all! Here’s what I have so far for a fake Depth of Field effect. As you can see, it’s not very polished yet, but it does have decent framerate! I would like to ask for assistance concerning this.
Note: This effect only works for backgrounds DoF. Any closer objects will not be blurred by using this technique

Short Explanation of how it works:

Main Camera in main scene sees something until there’s a black plane, which is for the alpha cutout via nodes for a render-to-texture plane.
Another Rtt plane is created in a different scene. The camera for this Rtt plane sees only what is passed the black plane in the previously stated scene.
The previous scene then adds the other scene as a background. This background scene has an extreme SSAA filter in it.
Fake Camera views only the Rtt alpha cutout of the main scene with a blurred background scene behind it.

Any ideas to improve? As you might see, there is a small line that cuts out part of the scene.

Thanks in advance,

NinjAcademy

Well, I just discovered how to get rid of the line cutout.


Now all I have to do to adjust the area of blurring is setting the clipping to different planes. Still, I would like any ideas from people to improve the effect. Is there any really good, not very expensive framerate-wise 2D filters for the background scene?

Also, is there any way to have an overlay scene with a filter on it that doesn’t apply to the rest of the scenes?

I have a Tip for you:


int samples = 16;
vec2 space = vec2(16*0.0001,9*0.0001) //includes 16:9 Correction
for (int i = 0; i < samples; ++i) {
 vec2 coord = vec2( gl_TexCoord[0].x+(sin(i)*i*space[1]), gl_TexCoord[0].y+(cos(i)*i*space[0]));
 blur += (texture2D(bgl_RenderedTexture,coord.st).rgb) /(samples);
}

This is my very own Way to blur Things, it is a Spiral Method and looks pretty natural if you ask me and is ~relatively~ performance-light.

Thank you very much! The blur didn’t quite work on my computer, but quite a few 2D filters don’t work. This fake effect will go great in my project.

-NinjAcademy