XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

2D Shader Question

Last post 6/18/2008 4:14 PM by GoDFaDDa. 4 replies.
  • 6/18/2008 4:03 AM

    2D Shader Question

    Does anyone know of a very simple 2D pixelshader that will 'soften' up the image, or use a gaussian blur of sort?  I have a Guassian Blur shader, but I honestly don't know how to implement it.

    But the simplicity of what I'm looking for is like what;s found here: http://www.facewound.com/tutorials/shader1/

    They have sharpen, but not soften.

    Thanks.

  • 6/18/2008 4:20 AM In reply to

    Re: 2D Shader Question

     

    Have a look at the Bloom Sample on this site, it will show you how to intergrate them using a drawable game component.

  • 6/18/2008 5:34 AM In reply to

    Re: 2D Shader Question

    The answer can be found on the page you mentioned, around three quarters of the way down.

    Color = tex2D( g_samSrcColor, Tex.xy);  
    Color += tex2D( g_samSrcColor, Tex.xy+0.001);  
    Color += tex2D( g_samSrcColor, Tex.xy+0.002);  
    Color += tex2D( g_samSrcColor, Tex.xy+0.003);  
    Color = Color / 4;  
     
     
    Notice how the image is slightly 'blurred' or softened. The bloom sample that Glenn mentioned does something similar.
    --
    Ruina et Stragos
    XNA SA
    --
  • 6/18/2008 3:11 PM In reply to

    Re: 2D Shader Question

    Yes, but for this one, it is more of a diagonal motion blur.  I'm looking for something where I can change the 'focus' to an extent, etc.

     

    I'll check out the bloom sample, though.  It applies to 2D as well, right?

  • 6/18/2008 4:14 PM In reply to

    Re: 2D Shader Question

    L337 Ghandi:

    I'll check out the bloom sample, though.  It applies to 2D as well, right?

    It will bloom whatever the contents of the current rendertarget (typically the backbuffer) is when the included GameComponent is drawn.  We use it in the Vector Rumble mini-game and the Net Rumble starter kit, which are two-dimensional games. 

     

    You may also be interested in our Sprite Effects sample.

    Matthew Picioccio
    XNA Developer Connection
Page 1 of 1 (5 items) Previous Next