Discussion:
How do I make blur?
(too old to reply)
Tomasz Raźniewski
2009-05-13 20:42:50 UTC
Permalink
Hello.
Recently I've managed to write some basic vertex and pixel shader, however I
was looking for something more advanced, like e.g. blurring the output
image. I have imagined that I could just post-process the output bitmap (as
a normal one)... But while searching for some solutions/answers on the web,
I've found out that it's not so simple (at least for me now).
One of pretty good answers, was the one that I should choose another render
target (I understand - not the screen, but some other "invisible" buffer),
then process this image, and finally present it.
Forgive me, but I don't have a clue how should I do all this. Help, anyone?
xissburg
2009-06-13 15:06:01 UTC
Permalink
Post by Tomasz Raźniewski
Hello.
Recently I've managed to write some basic vertex and pixel shader, however I
was looking for something more advanced, like e.g. blurring the output
image. I have imagined that I could just post-process the output bitmap (as
a normal one)... But while searching for some solutions/answers on the web,
I've found out that it's not so simple (at least for me now).
One of pretty good answers, was the one that I should choose another render
target (I understand - not the screen, but some other "invisible" buffer),
then process this image, and finally present it.
Forgive me, but I don't have a clue how should I do all this. Help, anyone?
First you render the scene on another render target. Then, you reset the
render target (now the render target is the frame buffer), set the previous
render target (which has the rendered scene on it) as the current texture,
set the blur pixel shader and render a rectangle (two triangles) that covers
the whole screen with proper texture coordinates and vertex positions so that
you directly map texels to pixels. Its basically that.

In the blur pixel shader, you just have to sample several texels around the
current pixel you're processing. Look up for Gaussian blur on Wikipedia, for
example.

HTH

Loading...