How to apply blur to a texture

Started by
6 comments, last by mdias 19 years, 6 months ago
Hi How can I apply blur to a texture using only the GPU? What I want to do is apply glow to a scene and the only thing I can find on the internet says "apply blur to the texture" but they don't actualy say how to do it. Can someone help me please? Thanks in advance.
Advertisement
this article might be helpful to you..
http://www.gamasutra.com/features/20040526/james_01.shtml
Good evening,
What you might want to also try is open a normal paint program... if you have photoshop that would also work and just apply a blur to the texture itself. It works and what we want is functionality. I know you want to use the GPU but this is another option.
Quote:Original post by ilian
this article might be helpful to you..
http://www.gamasutra.com/features/20040526/james_01.shtml

Yes, I've read that article before and yes, it is very useful however I don't understand much about shaders and I don't know which values to put in the constant registers.
Quote:Original post by Armadon
Good evening,
What you might want to also try is open a normal paint program... if you have photoshop that would also work and just apply a blur to the texture itself. It works and what we want is functionality. I know you want to use the GPU but this is another option.

What I really want to do is real-time glowing in my application.

I guess what I really need right now is a simple glow sample sourcecode.
Thanks to all who replied so far.
This paper might help:

http://developer.nvidia.com/docs/IO/8230/D3DTutorial_EffectsNV.pdf
Quote:Original post by don
This paper might help:

http://developer.nvidia.com/docs/IO/8230/D3DTutorial_EffectsNV.pdf

I've seen it already, it only says that I have to apply blur, but it doesn't say HOW to apply that blur :(
It does, but I understand how it might not be clear..

There are lots of algorithms for doing it, the basic idea is this:

Put the texture you want to blur into multiple texture stages, and have the vertex shader output different texture coordinates for each stage.

Then in the pixel shader, you average together the pixels from all the stages.

one example might be:

I want to blur a texture, so I put it into texture stages, 0,1,2, and 3.

I pick some kind of blur amount "r".
I set up the vertex shader constants so that it offsets the texture in each stage by something based on r.

so the constants might look like:
stage 0: u_offset = r, v_offset = r
stage 1: u_offset = -r, v_offset = -r
stage 2: u_offset = r, v_offset = -r
stage 3: u_offset = -r, v_offset = r

then in my pixel shader I would want to output the color:
(T0+T1+T2+T3)/4

stage
Ahhh, that's exacly what I was looking for.
Thank you a lot! :D

This topic is closed to new replies.

Advertisement