Jump to content

Help Blur Shader


pepsi18

Recommended Posts

as I can achieve this effect

Kux7rC5.png

I tried this but it does not work :cry:

texture ScreenTexture;   
  
float Angle = 0;  // Defines the blurring direction 
float BlurAmount = 0.005;  // Defines the blurring magnitude 
  
sampler ImageSampler = sampler_state 
{ 
    Texture = ; 
}; 
  
  
float4 main( float2 uv : TEXCOORD) : COLOR 
{ 
    float4 output = 0;  // Defines the output color of a pixel 
    float2 offset;  // Defines the blurring direction as a direction vector 
    int count = 24;  // Defines the number of blurring iterations 
  
    //First compute a direction vector which defines the direction of blurring.  
    //  This is done using the sincos instruction and the Angle input parameter,  
    //  and the result is stored in the offset variable. This vector is of unit  
    //  length. Multiply this unit vector by BlurAmount to adjust its length to  
    //  reflect the blurring magnitude. 
    sincos(Angle, offset.y, offset.x); 
    offset *= BlurAmount; 
  
    // To generate the blurred image, we  
    //  generate multiple copies of the input image, shifted  
    //  according to the blurring direction vector, and then sum  
    //  them all up to get the final image. 
    for(int i=0; i) 
         { 
              output += tex2D(ImageSampler, uv - offset * i); 
         } 
    output /= count; // Normalize the color 
  
    return output; 
}; 
  
technique MotionBlur 
{ 
    pass P1 
    { 
        PixelShader = compile ps_2_0 main(); 
    } 
} 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...