Help about fake depth of field effect

BlitzMax Forums/BlitzMax Programming/Help about fake depth of field effect

Canali(Posted 2007) [#1]
Hi.
I have a main drawing routine that is the "standard":

Repeat
...
...
DrawImage ...
Flip;Cls
Until KeyHit (KEY_ESCAPE)

Before flipping the backbuffer to the front, I would like to QUICKLY "blur" a part of the backbuffer (for instance the top 100 lines) to obtain something similar to a depht of field.

Anyone has a QUICK routine to accomplish this, somehting like:
Blur (x1,y1,x2,y2,Q) where x1,y1 are the top left corner of the area of the backbuffer, x2,x2 are the lower right corner and Q the quantity of blur passes?

Thanks.
And sorry for my poor english but I'm Italian.
:)


JoshK(Posted 2007) [#2]
Take an average of the samples along the horizontal and vertical lines, then add the results and divide by two. This will require n+n reads instead of n*n.


MGE(Posted 2007) [#3]
hmm.. if your background is stable, I did something like a blur effect by rendering the same image a few times at floating point variations from the original location, with alpha barely on, it did make it look blurry, etc. But you end up having to render the same image 1 to X amount of times. The more you render the more blurry it would look.