Sign in to follow this  
mdias

How to apply blur to a texture

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 :(

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this